8000 Stricter validation of rcParams["axes.axisbelow"]. · matplotlib/matplotlib@8bf19f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8bf19f2

Browse files
committed
Stricter validation of rcParams["axes.axisbelow"].
I don't see a good reason to support "LiNefoobar" to mean "line", tbh...
1 parent ead45c7 commit 8bf19f2

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

doc/api/next_api_changes/deprecations.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ The following validators, defined in `.rcsetup`, are deprecated:
224224
value would be acceptable, one can test e.g. ``rc = RcParams(); rc[k] = v``
225225
raises an exception.
226226

227+
Stricter rcParam validation
228+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
229+
:rc:`axes.axisbelow` currently normalizes all strings starting with "line"
230+
(case-insensitive) to the option "line". This is deprecated; in a future
231+
version only the exact string "line" (case-sensitive) will be supported.
232+
227233
Toggling axes navigation from the keyboard using "a" and digit keys
228234
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
229235
Axes navigation can still be toggled programmatically using

lib/matplotlib/rcsetup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,14 @@ def validate_axisbelow(s):
180180
return validate_bool(s)
181181
except ValueError:
182182
if isinstance(s, str):
183-
s = s.lower()
184-
if s.startswith('line'):
183+
if s == 'line':
184+
return 'line'
185+
if s.lower().startswith('line'):
186+
cbook.warn_deprecated(
187+
"3.3", message=f"Support for setting axes.axisbelow to "
188+
f"{s!r} to mean 'line' is deprecated since %(since)s and "
189+
f"will be removed in %(removal)s; set it to 'line' "
190+
"instead.")
185191
return 'line'
186192
raise ValueError('%s cannot be interpreted as'
187193
' True, False, or "line"' % s)

0 commit comments

Comments
 (0)
0