Skip to content

Remove some deprecated rcParams. #10028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/api/api_changes/2017-12-17-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Removal of deprecated rcParams
``````````````````````````````

The following deprecated rcParams have been removed:
- ``axes.color_cycle`` (see ``axes.prop_cycle``),
- ``legend.isaxes``,
- ``svg.embed_char_paths`` (see ``svg.fonttype``),
- ``text.fontstyle``, ``text.fontangle``, ``text.fontvariant``,
``text.fontweight``, ``text.fontsize`` (renamed to ``text.style``, etc.),
- ``tick.size`` (renamed to ``tick.major.size``).
16 changes: 2 additions & 14 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,23 +843,11 @@ def gen_candidates():
# names of keys to deprecate
# the values are a tuple of (new_name, f_old_2_new, f_new_2_old)
# the inverse function may be `None`
_deprecated_map = {
'text.fontstyle': ('font.style', lambda x: x, None),
'text.fontangle': ('font.style', lambda x: x, None),
'text.fontvariant': ('font.variant', lambda x: x, None),
'text.fontweight': ('font.weight', lambda x: x, None),
'text.fontsize': ('font.size', lambda x: x, None),
'tick.size': ('tick.major.size', lambda x: x, None),
'svg.embed_char_paths': ('svg.fonttype',
lambda x: "path" if x else "none", None),
'axes.color_cycle': ('axes.prop_cycle', lambda x: cycler('color', x),
lambda x: [c.get('color', None) for c in x]),
'svg.image_noscale': ('image.interpolation', None, None),
}
_deprecated_map = {}

_deprecated_ignore_map = {}

_obsolete_set = {'text.dvipnghack', 'legend.isaxes'}
_obsolete_set = {'text.dvipnghack'}

# The following may use a value of None to suppress the warning.
_deprecated_set = {'axes.hold'} # do NOT include in _all_deprecated
Expand Down
28 changes: 0 additions & 28 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,6 @@ def validate_color(s):
raise ValueError('%s does not look like a color arg%s' % (s, msg))


def deprecate_axes_colorcycle(value):
warnings.warn("axes.color_cycle is deprecated. Use axes.prop_cycle "
"instead. Will be removed in 2.1.0",
mplDeprecation)
return validate_colorlist(value)


validate_colorlist = _listify_validator(validate_color, allow_stringlist=True)
validate_colorlist.__doc__ = 'return a list of colorspecs'

Expand Down Expand Up @@ -572,18 +565,6 @@ def validate_corner_mask(s):
'center'], ignorecase=True)


def deprecate_svg_image_noscale(value):
warnings.warn("svg.image_noscale is deprecated. Set "
"image.interpolation to 'none' instead.",
mplDeprecation)


def deprecate_svg_embed_char_paths(value):
warnings.warn("svg.embed_char_paths is deprecated. Use "
"svg.fonttype instead.",
mplDeprecation)


validate_svg_fonttype = ValidateInStrings('svg.fonttype',
['none', 'path', 'svgfont'])

Expand Down Expand Up @@ -1155,12 +1136,6 @@ def _validate_linestyle(ls):
'axes.formatter.useoffset': [True, validate_bool],
'axes.formatter.offset_threshold': [4, validate_int],
'axes.unicode_minus': [True, validate_bool],
'axes.color_cycle': [
['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728',
'#9467bd', '#8c564b', '#e377c2', '#7f7f7f',
'#bcbd22', '#17becf'],
deprecate_axes_colorcycle], # cycle of plot
# line colors
# This entry can be either a cycler object or a
# string repr of a cycler-object, which gets eval()'ed
# to create the object.
Expand Down Expand Up @@ -1351,10 +1326,7 @@ def _validate_linestyle(ls):

# write raster image data directly into the svg file
'svg.image_inline': [True, validate_bool],
# suppress scaling of raster data embedded in SVG
'svg.image_noscale': [False, deprecate_svg_image_noscale],
# True to save all characters as paths in the SVG
'svg.embed_char_paths': [True, deprecate_svg_embed_char_paths],
'svg.fonttype': ['path', validate_svg_fonttype],
'svg.hashsalt': [None, validate_string_or_None],

Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@ def test_Bug_2543():
# real test is that this does not raise
assert validate_bool_maybe_none(None) is None
assert validate_bool_maybe_none("none") is None
_fonttype = mpl.rcParams['svg.fonttype']
assert _fonttype == mpl.rcParams['svg.embed_char_paths']
with mpl.rc_context():
mpl.rcParams['svg.embed_char_paths'] = False
assert mpl.rcParams['svg.fonttype'] == "none"

with pytest.raises(ValueError):
validate_bool_maybe_none("blah")
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def temp_style(style_name, settings=None):
style.reload_library()


def test_deprecated_rc_warning_includes_filename():
SETTINGS = {'axes.color_cycle': 'ffffff'}
basename = 'color_cycle'
def test_invalid_rc_warning_includes_filename():
SETTINGS = {'foo': 'bar'}
basename = 'basename'
with warnings.catch_warnings(record=True) as warns:
with temp_style(basename, SETTINGS):
# style.reload_library() in temp_style() triggers the warning
Expand Down