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

Skip to content

Commit ad66238

Browse files
authored
Merge pull request #20753 from anntzer/css
Deprecate support for case-insensitive scales.
2 parents 3a46327 + a3f121e commit ad66238

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Case-insensitive scales
2+
~~~~~~~~~~~~~~~~~~~~~~~
3+
Previously, scales could be set case-insensitively (e.g. ``set_xscale("LoG")``).
4+
This is deprecated; all builtin scales use lowercase names.

lib/matplotlib/scale.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,13 @@ def scale_factory(scale, axis, **kwargs):
588588
scale : {%(names)s}
589589
axis : `matplotlib.axis.Axis`
590590
"""
591-
scale = scale.lower()
592-
_api.check_in_list(_scale_mapping, scale=scale)
593-
return _scale_mapping[scale](axis, **kwargs)
591+
if scale != scale.lower():
592+
_api.warn_deprecated(
593+
"3.5", message="Support for case-insensitive scales is deprecated "
594+
"since %(since)s and support will be removed %(removal)s.")
595+
scale = scale.lower()
596+
scale_cls = _api.check_getitem(_scale_mapping, scale=scale)
597+
return scale_cls(axis, **kwargs)
594598

595599

596600
if scale_factory.__doc__:

0 commit comments

Comments
 (0)