Skip to content

Commit 5ef93f9

Browse files
authored
Merge pull request matplotlib#15119 from anntzer/update_savefig_format
Deprecate a validator for a deprecated rcParam value.
2 parents a9d1052 + b4f9caf commit 5ef93f9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

doc/api/next_api_changes/2019-07-30-AL.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Setting :rc:`savefig.format` to "auto" is deprecated; use its synonym "png" inst
55

66
Setting :rc:`text.hinting` to True or False is deprecated; use their synonyms
77
"auto" or "none" instead.
8+
9+
``rcsetup.update_savefig_format`` is deprecated.

lib/matplotlib/rcsetup.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ def validate_whiskers(s):
458458
"(float, float)]")
459459

460460

461+
@cbook.deprecated("3.2")
461462
def update_savefig_format(value):
462463
# The old savefig.extension could also have a value of "auto", but
463464
# the new savefig.format does not. We need to fix this here.
@@ -471,6 +472,20 @@ def update_savefig_format(value):
471472
return value
472473

473474

475+
# Replace by validate_string once deprecation period passes.
476+
def _update_savefig_format(value):
477+
# The old savefig.extension could also have a value of "auto", but
478+
# the new savefig.format does not. We need to fix this here.
479+
value = validate_string(value)
480+
if value == 'auto':
481+
cbook.warn_deprecated(
482+
"3.2", message="Support for setting the 'savefig.format' rcParam "
483+
"to 'auto' is deprecated since %(since)s and will be removed "
484+
"%(removal)s; set it to 'png' instead.")
485+
value = 'png'
486+
return value
487+
488+
474489
validate_ps_papersize = ValidateInStrings(
475490
'ps_papersize',
476491
['auto', 'letter', 'legal', 'ledger',
@@ -1344,7 +1359,7 @@ def _validate_linestyle(ls):
13441359
'savefig.orientation': ['portrait', validate_orientation],
13451360
'savefig.jpeg_quality': [95, validate_int],
13461361
# value checked by backend at runtime
1347-
'savefig.format': ['png', update_savefig_format],
1362+
'savefig.format': ['png', _update_savefig_format],
13481363
# options are 'tight', or 'standard'. 'standard' validates to None.
13491364
'savefig.bbox': ['standard', validate_bbox],
13501365
'savefig.pad_inches': [0.1, validate_float],

0 commit comments

Comments
 (0)