@@ -2008,11 +2008,13 @@ def print_figure(
20082008 dpi : float, default: :rc:`savefig.dpi`
20092009 The dots per inch to save the figure in.
20102010
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.
20132014
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.
20162018
20172019 orientation : {'landscape', 'portrait'}, default: 'portrait'
20182020 Only currently applies to PostScript printing.
@@ -2068,21 +2070,23 @@ def print_figure(
20682070 # but this should be fine.
20692071 with cbook ._setattr_cm (self , _is_saving = True , manager = None ), \
20702072 cbook ._setattr_cm (self .figure , dpi = dpi ):
2073+ origfacecolor = self .figure .get_facecolor ()
2074+ origedgecolor = self .figure .get_edgecolor ()
20712075
20722076 if facecolor is None :
20732077 facecolor = rcParams ['savefig.facecolor' ]
2078+ if cbook ._str_equal (facecolor , 'auto' ):
2079+ facecolor = origfacecolor
20742080 if edgecolor is None :
20752081 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
20792084
20802085 self .figure .set_facecolor (facecolor )
20812086 self .figure .set_edgecolor (edgecolor )
20822087
20832088 if bbox_inches is None :
20842089 bbox_inches = rcParams ['savefig.bbox' ]
2085-
20862090 if bbox_inches :
20872091 if bbox_inches == "tight" :
20882092 renderer = _get_renderer (
0 commit comments