@@ -2008,11 +2008,13 @@ def print_figure(
2008
2008
dpi : float, default: :rc:`savefig.dpi`
2009
2009
The dots per inch to save the figure in.
2010
2010
2011
- facecolor : color, default: :rc:`savefig.facecolor`
2012
- The facecolor of the figure.
2011
+ facecolor : color or 'auto', default: :rc:`savefig.facecolor`
2012
+ The facecolor of the figure. If 'auto', use the current figure
2013
+ facecolor.
2013
2014
2014
- edgecolor : color, default: :rc:`savefig.edgecolor`
2015
- The edgecolor of the figure.
2015
+ edgecolor : color or 'auto', default: :rc:`savefig.edgecolor`
2016
+ The edgecolor of the figure. If 'auto', use the current figure
2017
+ edgecolor.
2016
2018
2017
2019
orientation : {'landscape', 'portrait'}, default: 'portrait'
2018
2020
Only currently applies to PostScript printing.
@@ -2068,21 +2070,23 @@ def print_figure(
2068
2070
# but this should be fine.
2069
2071
with cbook ._setattr_cm (self , _is_saving = True , manager = None ), \
2070
2072
cbook ._setattr_cm (self .figure , dpi = dpi ):
2073
+ origfacecolor = self .figure .get_facecolor ()
2074
+ origedgecolor = self .figure .get_edgecolor ()
2071
2075
2072
2076
if facecolor is None :
2073
2077
facecolor = rcParams ['savefig.facecolor' ]
2078
+ if cbook ._str_equal (facecolor , 'auto' ):
2079
+ facecolor = origfacecolor
2074
2080
if edgecolor is None :
2075
2081
edgecolor = rcParams ['savefig.edgecolor' ]
2076
-
2077
- origfacecolor = self .figure .get_facecolor ()
2078
- origedgecolor = self .figure .get_edgecolor ()
2082
+ if cbook ._str_equal (edgecolor , 'auto' ):
2083
+ edgecolor = origedgecolor
2079
2084
2080
2085
self .figure .set_facecolor (facecolor )
2081
2086
self .figure .set_edgecolor (edgecolor )
2082
2087
2083
2088
if bbox_inches is None :
2084
2089
bbox_inches = rcParams ['savefig.bbox' ]
2085
-
2086
2090
if bbox_inches :
2087
2091
if bbox_inches == "tight" :
2088
2092
renderer = _get_renderer (
0 commit comments