8000 If the user has "savefig.extension : auto" (deprecated) in their (old… · matplotlib/matplotlib@f145b2d · GitHub
[go: up one dir, main page]

Skip to content

Commit f145b2d

Browse files
committed
If the user has "savefig.extension : auto" (deprecated) in their (old) matplotlibrc, it will be copied into "savefig.format", where "auto" is not a supported choice. This will fix it so it becomes "png" if it's currently set to "auto". This bug discovered as part of #1530, though it doesn't fix it.
1 parent ea8c00b commit f145b2d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,15 @@ def validate_font_properties(s):
257257

258258
def deprecate_savefig_extension(value):
259259
warnings.warn("savefig.extension is deprecated. Use savefig.format instead.")
260+
return value
261+
262+
def update_savefig_format(value):
263+
# The old savefig.extension could also have a value of "auto", but
264+
# the new savefig.format does not. We need to fix this here.
265+
value = str(value)
266+
if value == 'auto':
267+
value = 'png'
268+
return value
260269

261270
validate_ps_papersize = ValidateInStrings('ps_papersize',[
262271
'auto', 'letter', 'legal', 'ledger',
@@ -327,7 +336,8 @@ def validate_hinting(s):
327336
['xelatex', 'lualatex', 'pdflatex'])
328337

329338
validate_movie_writer = ValidateInStrings('animation.writer',
330-
['ffmpeg', 'ffmpeg_file', 'mencoder', 'mencoder_file'])
339+
['ffmpeg', 'ffmpeg_file', 'mencoder', 'mencoder_file',
340+
'imagemagick', 'imagemagick_file'])
331341

332342
validate_movie_frame_fmt = ValidateInStrings('animation.frame_format',
333343
['png', 'jpeg', 'tiff', 'raw', 'rgba'])
@@ -566,7 +576,7 @@ def __call__(self, s):
566576
'savefig.edgecolor' : ['w', validate_color], # edgecolor; white
567577
'savefig.orientation' : ['portrait', validate_orientation], # edgecolor; white
568578
'savefig.extension' : ['png', deprecate_savefig_extension], # what to add to extensionless filenames
569-
'savefig.format' : ['png', str], # value checked by backend at runtime
579+
'savefig.format' : ['png', update_savefig_format], # value checked by backend at runtime
570580
'savefig.bbox' : [None, validate_bbox], # options are 'tight', or 'standard'. 'standard' validates to None.
571581
'savefig.pad_inches' : [0.1, validate_float],
572582

0 commit comments

Comments
 (0)
0