Skip to content

Figure background colors #7619

@darkdragon-001

Description

@darkdragon-001

I find the current handling of background colors very non-intuitive:

  1. figure facecolor is not applied for savefig() by default
  2. figure facecolor is not applied setting frameon=False
  3. axis_bgcolor is not applied when hiding axis lines/ticks via axis('off')

So using a white plain surface to draw objects needs the following code:

fig = figure(..., facecolor='w', edgecolor='None')
ax.axis('equal')        # equal scale
ax.axis('off')          # do not show axis
ax.axis([-1, 1, -1, 1]) # scale to unit lengths
show()
fig.savefig(..., facecolor=fig.get_facecolor(), edgecolor='None', transparent=True)

My suggestion

  • apply same colors to savefig() by default
  • mention in the docs of axis_bgcolor and axis('off') that this setting is ignored
  • mention in the docs of facecolor and frameon that this setting is ignored

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy