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 d883cdb

Browse filesBrowse files
committed
added figure.frameon and savefig.frameon to rcparams
1 parent 8605579 commit d883cdb
Copy full SHA for d883cdb

File tree

Expand file treeCollapse file tree

2 files changed

+20
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-3
lines changed

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+18-3Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def __init__(self,
259259
facecolor=None, # defaults to rc figure.facecolor
260260
edgecolor=None, # defaults to rc figure.edgecolor
261261
linewidth=0.0, # the default linewidth of the frame
262-
frameon=True, # whether or not to draw the figure frame
262+
frameon=None, # whether or not to draw the figure frame
263263
subplotpars=None, # default to rc
264264
tight_layout=None, # default to rc figure.autolayout
265265
):
@@ -302,6 +302,8 @@ def __init__(self,
302302
facecolor = rcParams['figure.facecolor']
303303
if edgecolor is None:
304304
edgecolor = rcParams['figure.edgecolor']
305+
if frameon is None:
306+
frameon = rcParams['figure.frameon']
305307

306308
self.dpi_scale_trans = Affine2D()
307309
self.dpi = dpi
@@ -1306,7 +1308,8 @@ def savefig(self, *args, **kwargs):
13061308
13071309
savefig(fname, dpi=None, facecolor='w', edgecolor='w',
13081310
orientation='portrait', papertype=None, format=None,
1309-
transparent=False, bbox_inches=None, pad_inches=0.1)
1311+
transparent=False, bbox_inches=None, pad_inches=0.1,
1312+
frameon=None)
13101313
13111314
The output formats available depend on the backend being used.
13121315
@@ -1355,6 +1358,10 @@ def savefig(self, *args, **kwargs):
13551358
transparency of these patches will be restored to their
13561359
original values upon exit of this function.
13571360
1361+
*frameon*:
1362+
If *True*, the figure patch will be colored. Else the figure
1363+
background will be transparent.
1364+
13581365
*bbox_inches*:
13591366
Bbox in inches. Only the given portion of the figure is
13601367
saved. If 'tight', try to figure out the tight bbox of
@@ -1371,8 +1378,9 @@ def savefig(self, *args, **kwargs):
13711378
"""
13721379

13731380
kwargs.setdefault('dpi', rcParams['savefig.dpi'])
1374-
1381+
frameon = kwargs.pop('frameon', rcParams['savefig.frameon'])
13751382
transparent = kwargs.pop('transparent', False)
1383+
13761384
if transparent:
13771385
kwargs.setdefault('facecolor', 'none')
13781386
kwargs.setdefault('edgecolor', 'none')
@@ -1387,8 +1395,15 @@ def savefig(self, *args, **kwargs):
13871395
kwargs.setdefault('facecolor', rcParams['savefig.facecolor'])
13881396
kwargs.setdefault('edgecolor', rcParams['savefig.edgecolor'])
13891397

1398+
if frameon:
1399+
original_frameon = self.get_frameon()
1400+
self.set_frameon(frameon)
1401+
13901402
self.canvas.print_figure(*args, **kwargs)
13911403

1404+
if frameon:
1405+
self.set_frameon(original_frameon)
1406+
13921407
if transparent:
13931408
for ax, cc in zip(self.axes, original_axes_colors):
13941409
ax.patch.set_facecolor(cc[0])

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ def __call__(self, s):
658658
'figure.dpi': [80, validate_float], # DPI
659659
'figure.facecolor': ['0.75', validate_color], # facecolor; scalar gray
660660
'figure.edgecolor': ['w', validate_color], # edgecolor; white
661+
'figure.frameon': [True, validate_bool],
661662
'figure.autolayout': [False, validate_bool],
662663

663664
'figure.subplot.left': [0.125, ValidateInterval(0, 1, closedmin=True,
@@ -677,6 +678,7 @@ def __call__(self, s):
677678
'savefig.dpi': [100, validate_float], # DPI
678679
'savefig.facecolor': ['w', validate_color], # facecolor; white
679680
'savefig.edgecolor': ['w', validate_color], # edgecolor; white
681+
'savefig.frameon': [True, validate_bool],
680682
'savefig.orientation': ['portrait', validate_orientation], # edgecolor;
681683
#white
682684
# what to add to extensionless filenames

0 commit comments

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