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

Skip to content

Commit 2cc5d8d

Browse files
authored
Merge pull request #14931 from anntzer/rcvals
Deprecate some obscure rcParam synonyms.
2 parents 9affee4 + 0f21ff7 commit 2cc5d8d

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
API deprecations
2+
````````````````
3+
4+
Setting :rc:`savefig.format` to "auto" is deprecated; use its synonym "png" instead.
5+
6+
Setting :rc:`text.hinting` to True or False is deprecated; use their synonyms
7+
"auto" or "none" instead.

lib/matplotlib/rcsetup.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,10 @@ def update_savefig_format(value):
463463
# the new savefig.format does not. We need to fix this here.
464464
value = validate_string(value)
465465
if value == 'auto':
466+
cbook.warn_deprecated(
467+
"3.2", message="Support for setting the 'savefig.format' rcParam "
468+
"to 'auto' is deprecated since %(since)s and will be removed "
469+
"%(removal)s; set it to 'png' instead.")
466470
value = 'png'
467471
return value
468472

@@ -569,16 +573,15 @@ def validate_markevery(s):
569573
'upper center',
570574
'center'], ignorecase=True)
571575

572-
573-
def validate_svg_fonttype(s):
574-
if s in ["none", "path"]:
575-
return s
576-
raise ValueError("Unrecognized svg.fonttype string '{}'; "
577-
"valid strings are 'none', 'path'")
576+
validate_svg_fonttype = ValidateInStrings('svg.fonttype', ['none', 'path'])
578577

579578

580579
def validate_hinting(s):
581580
if s in (True, False):
581+
cbook.warn_deprecated(
582+
"3.2", message="Support for setting the text.hinting rcParam to "
583+
"True or False is deprecated since %(since)s and will be removed "
584+
"%(removal)s; set it to its synonyms 'auto' or 'none' instead.")
582585
return s
583586
if s.lower() in ('auto', 'native', 'either', 'none'):
584587
return s.lower()

lib/matplotlib/testing/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def is_called_from_pytest():
2020

2121
def set_font_settings_for_testing():
2222
mpl.rcParams['font.family'] = 'DejaVu Sans'
23-
mpl.rcParams['text.hinting'] = False
23+
mpl.rcParams['text.hinting'] = 'none'
2424
mpl.rcParams['text.hinting_factor'] = 8
2525

2626

matplotlibrc.template

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@
313313
## FreeType library supports it
314314
## - either: Use the native hinting information,
315315
## or the autohinter if none is available.
316-
## For backward compatibility, this value may also be
317-
## True === 'auto' or False === 'none'.
318316
#text.hinting_factor : 8 ## Specifies the amount of softness for hinting in the
319317
## horizontal direction. A value of 1 will hint to full
320318
## pixels. A value of 2 will hint to half pixels etc.

0 commit comments

Comments
 (0)