Bug Report: saved Figure ignores figure.facecolor · Issue #17467 · matplotlib/matplotlib · GitHub
Skip to content

Bug Report: saved Figure ignores figure.facecolor #17467

Description

@DanielGoldfarb

Bug report

When saving a figure, either via plt.savefig() or by clicking the disk icon on the figure display UI, the saved figure has no facecolor.

Code for reproduction

dino@DINO:~/code/mplfinance$ ipython
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import matplotlib as mpl

In [2]: mpl.__version__
Out[2]: '3.1.3'

In [3]: import matplotlib.pyplot as plt

In [4]: y = [2,4,3,7,1]
In [5]: x = [0,1,2,3,4]

In [6]: plt.rcParams['figure.facecolor'] = 'c'

In [7]: plt.plot(x,y)
Out[7]: [<matplotlib.lines.Line2D at 0x7ff9eeb49090>]

In [8]: plt.show()

In [9]: plt.rcParams['figure.facecolor'] = 'c'
In [10]: plt.plot(x,y)
Out[10]: [<matplotlib.lines.Line2D at 0x7ff9d7890d10>]

In [11]: plt.savefig('testsave.png')

Here is what the plot looks like upon plt.show()

matplotlib_fig1


Here is what the plot looks like when I click the disk icon on the above UI to save the plot:

matplotlib_fig1saved


Here is what the plot looks like when I call plt.savefig('testsave.png')

matplotlib_testsave

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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