File tree 6 files changed +19
-2
lines changed
Filter options
6 files changed +19
-2
lines changed
Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ original location:
59
59
thus `colorbar.ColorbarBase.outline ` is now a
60
60
`matplotlib.patches.Polygon ` object.
61
61
62
+ * The rcParams `savefig.transparent ` has been added to control
63
+ default transparency when saving figures.
64
+
62
65
.. _changes_in_1_3 :
63
66
64
67
Original file line number Diff line number Diff line change @@ -44,6 +44,15 @@ and :func:`matplotlib.dates.datestr2num`. Support is also added to the unit
44
44
conversion interfaces :class: `matplotlib.dates.DateConverter ` and
45
45
:class: `matplotlib.units.Registry `.
46
46
47
+ Configuration (rcParams)
48
+ ------------------------
49
+
50
+ ``savefig.transparent `` added
51
+ `````````````````````````````
52
+ Controls whether figures are saved with a transparent
53
+ background by default. Previously `savefig ` always defaulted
54
+ to a non-transparent background.
55
+
47
56
.. _whats-new-1-3 :
48
57
49
58
new in matplotlib-1.3
Original file line number Diff line number Diff line change @@ -1414,7 +1414,7 @@ def savefig(self, *args, **kwargs):
1414
1414
1415
1415
kwargs .setdefault ('dpi' , rcParams ['savefig.dpi' ])
1416
1416
frameon = kwargs .pop ('frameon' , rcParams ['savefig.frameon' ])
1417
- transparent = kwargs .pop ('transparent' , False )
1417
+ transparent = kwargs .pop ('transparent' , rcParams [ 'savefig.transparent' ] )
1418
1418
1419
1419
if transparent :
1420
1420
kwargs .setdefault ('facecolor' , 'none' )
Original file line number Diff line number Diff line change @@ -563,7 +563,9 @@ def draw():
563
563
@docstring .copy_dedent (Figure .savefig )
564
564
def savefig (* args , ** kwargs ):
565
565
fig = gcf ()
566
- return fig .savefig (* args , ** kwargs )
566
+ res = fig .savefig (* args , ** kwargs )
567
+ draw () # need this if 'transparent=True' to reset colors
568
+ return res
567
569
568
570
569
571
@docstring .copy_dedent (Figure .ginput )
Original file line number Diff line number Diff line change @@ -714,6 +714,7 @@ def __call__(self, s):
714
714
'savefig.pad_inches' : [0.1 , validate_float ],
715
715
# default directory in savefig dialog box
716
716
'savefig.directory' : ['~' , six .text_type ],
717
+ 'savefig.transparent' : [False , validate_bool ],
717
718
718
719
# Maintain shell focus for TkAgg
719
720
'tk.window_focus' : [False , validate_bool ],
Original file line number Diff line number Diff line change @@ -377,6 +377,8 @@ backend : %(backend)s
377
377
#savefig.jpeg_quality: 95 # when a jpeg is saved, the default quality parameter.
378
378
#savefig.directory : ~ # default directory in savefig dialog box,
379
379
# leave empty to always use current working directory
380
+ #savefig.transparent : False # setting that controls whether figures are saved with a
381
+ # transparent background by default
380
382
381
383
# tk backend params
382
384
#tk.window_focus : False # Maintain shell focus for TkAgg
You can’t perform that action at this time.
0 commit comments