Don't set savefig.facecolor/edgecolor in dark_background/538 styles. · matplotlib/matplotlib@3d758e2 · GitHub
Skip to content

Commit 3d758e2

Browse files
committed
Don't set savefig.facecolor/edgecolor in dark_background/538 styles.
Previously, the dark_background and fivethirtyeight styles would set the savefig.facecolor and savefig.edgecolor rcParams to the same values as figure.facecolor and figure.edgecolor; i.e., if a user uses a style but tweaks the figure facecolor, this tweak is lost (overridden) when saving the figure. A concrete example would be using the dark_background style but wanting a dark gray background instead of a black one, e.g. `mpl.style.use(["dark_background", {"figure.facecolor": ".2"}]); plot(); savefig(...)`. In all likelihood these values were set because the styles predate the ability to set these savefig rcParams to "auto", which means "don't change the figure facecolor, just use it as is" (a feature introduced exactly because this auto-switching of color by savefig was confusing users). Now we can just remove these rcParams from the two styles (which are the only ones affected by the issue -- the grayscale style also sets savefig.facecolor but to a value different from figure.facecolor) and let them inherit the global default value, "auto".
1 parent cebc4d8 commit 3d758e2

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

Lines changed: 12 additions & 0 deletions

lib/matplotlib/mpl-data/stylelib/dark_background.mplstyle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ grid.color: white
1818
figure.facecolor: black
1919
figure.edgecolor: black
2020

21-
savefig.facecolor: black
22-
savefig.edgecolor: black
23-
2421
### Boxplots
2522
boxplot.boxprops.color: white
2623
boxplot.capprops.color: white

lib/matplotlib/mpl-data/stylelib/fivethirtyeight.mplstyle

Lines changed: 1 addition & 4 deletions

0 commit comments

Comments
 (0)