Skip to content

Commit

Permalink
Merge pull request #1537 from mdboom/savefig.extension-fix
Browse files Browse the repository at this point in the history
Fix savefig.extension == "auto"
  • Loading branch information
mdboom committed Dec 3, 2012
2 parents ea8c00b + f145b2d commit f79562c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/matplotlib/rcsetup.py
Expand Up @@ -257,6 +257,15 @@ def validate_font_properties(s):

def deprecate_savefig_extension(value):
warnings.warn("savefig.extension is deprecated. Use savefig.format instead.")
return value

def update_savefig_format(value):
# The old savefig.extension could also have a value of "auto", but
# the new savefig.format does not. We need to fix this here.
value = str(value)
if value == 'auto':
value = 'png'
return value

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

validate_movie_writer = ValidateInStrings('animation.writer',
['ffmpeg', 'ffmpeg_file', 'mencoder', 'mencoder_file'])
['ffmpeg', 'ffmpeg_file', 'mencoder', 'mencoder_file',
'imagemagick', 'imagemagick_file'])

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

Expand Down

0 comments on commit f79562c

Please sign in to comment.