Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b937b7a

Browse files
committed
quick patch for issue matplotlib#192
1 parent 5b499f0 commit b937b7a

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

lib/matplotlib/figure.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,20 @@ def savefig(self, *args, **kwargs):
11601160
tight bbox is calculated.
11611161
11621162
"""
1163-
1163+
1164+
self._check_kwargs([
1165+
"dpi",
1166+
"facecolor",
1167+
"edgecolor",
1168+
"orientation",
1169+
"papertype",
1170+
"format",
1171+
"transparent",
1172+
"bbox_inches",
1173+
"pad_inches",
1174+
"bbox_extra_artists"
1175+
])
1176+
11641177
kwargs.setdefault('dpi', rcParams['savefig.dpi'])
11651178

11661179
extension = rcParams['savefig.extension']
@@ -1189,6 +1202,15 @@ def savefig(self, *args, **kwargs):
11891202
for ax, cc in zip(self.axes, original_axes_colors):
11901203
ax.patch.set_facecolor(cc[0])
11911204
ax.patch.set_edgecolor(cc[1])
1205+
1206+
def _check_kwargs(self, allowedkwargs, **kwargs):
1207+
"""
1208+
If a key in the given kwargs is not in the list allowedkwargs, print
1209+
a warning to console.
1210+
"""
1211+
for key in kwargs:
1212+
if not (key in allowedkwargs):
1213+
print 'Invalid Parameter:', key
11921214

11931215
@docstring.dedent_interpd
11941216
def colorbar(self, mappable, cax=None, ax=None, **kw):

0 commit comments

Comments
 (0)