Skip to content

Commit 10f2b0e

Browse files
committed
added 'savefig.transparent' rcParams
Closes issue matplotlib#2388
1 parent b7f7ddd commit 10f2b0e

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

doc/api/api_changes.rst

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ original location:
5959
thus `colorbar.ColorbarBase.outline` is now a
6060
`matplotlib.patches.Polygon` object.
6161

62+
* The rcParams `savefig.transparent` has been added to control
63+
default transparency when saving figures.
64+
6265
.. _changes_in_1_3:
6366

6467

lib/matplotlib/figure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ def savefig(self, *args, **kwargs):
14141414

14151415
kwargs.setdefault('dpi', rcParams['savefig.dpi'])
14161416
frameon = kwargs.pop('frameon', rcParams['savefig.frameon'])
1417-
transparent = kwargs.pop('transparent', False)
1417+
transparent = kwargs.pop('transparent', rcParams['savefig.transparent'])
14181418

14191419
if transparent:
14201420
kwargs.setdefault('facecolor', 'none')

lib/matplotlib/rcsetup.py

+1
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ def __call__(self, s):
714714
'savefig.pad_inches': [0.1, validate_float],
715715
# default directory in savefig dialog box
716716
'savefig.directory': ['~', six.text_type],
717+
'savefig.transparent': [False, validate_bool],
717718

718719
# Maintain shell focus for TkAgg
719720
'tk.window_focus': [False, validate_bool],

matplotlibrc.template

+1
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ backend : %(backend)s
377377
#savefig.jpeg_quality: 95 # when a jpeg is saved, the default quality parameter.
378378
#savefig.directory : ~ # default directory in savefig dialog box,
379379
# leave empty to always use current working directory
380+
#savefig.transparent : False # should transparency be enabled by default
380381

381382
# tk backend params
382383
#tk.window_focus : False # Maintain shell focus for TkAgg

0 commit comments

Comments
 (0)