Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3d758e2

Browse filesBrowse 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
Copy full SHA for 3d758e2

File tree

3 files changed

+13
-7
lines changed
Filter options

3 files changed

+13
-7
lines changed
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dark_background and fivethirtyeight styles no longer set ``savefig.facecolor`` and ``savefig.edgecolor``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
When using these styles, :rc:`savefig.facecolor` and :rc:`savefig.edgecolor`
5+
now inherit the global default value of "auto", which means that the actual
6+
figure colors will be used. Previously, these rcParams were set to the same
7+
values as :rc:`figure.facecolor` and :rc:`figure.edgecolor`, i.e. a saved
8+
figure would always use the theme colors even if the user manually overrode
9+
them; this is no longer the case.
10+
11+
This change should have no impact for users that do not manually set the figure
12+
face and edge colors.

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

Copy file name to clipboardExpand all lines: lib/matplotlib/mpl-data/stylelib/dark_background.mplstyle
-3Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/mpl-data/stylelib/fivethirtyeight.mplstyle
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ xtick.minor.size: 0
2929
ytick.major.size: 0
3030
ytick.minor.size: 0
3131

32-
font.size:14.0
33-
34-
savefig.edgecolor: f0f0f0
35-
savefig.facecolor: f0f0f0
32+
font.size: 14.0
3633

3734
figure.subplot.left: 0.08
3835
figure.subplot.right: 0.95

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.