Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 462eb5f

Browse filesBrowse files
committed
Remove support for upper case color strings.
1 parent e9eb00c commit 462eb5f
Copy full SHA for 462eb5f

File tree

Expand file treeCollapse file tree

3 files changed

+11
-19
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+11
-19
lines changed

‎doc/api/api_changes_3.3/behaviour.rst

Copy file name to clipboardExpand all lines: doc/api/api_changes_3.3/behaviour.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,9 @@ Passing Line2D's *drawstyle* together with *linestyle* is removed
208208
Instead of ``plt.plot(..., linestyle="steps--")``, use ``plt.plot(...,
209209
linestyle="--", drawstyle="steps")``. ``ds`` is also an alias for
210210
``drawstyle``.
211+
212+
Upper case color strings
213+
~~~~~~~~~~~~~~~~~~~~~~~~
214+
215+
Support for passing single-letter colors (one of "rgbcmykw") as UPPERCASE
216+
characters is removed; these colors are now case-sensitive (lowercase).

‎lib/matplotlib/colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colors.py
+5-11Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,11 @@ def _to_rgba_no_colorcycle(c, alpha=None):
198198
# This may turn c into a non-string, so we check again below.
199199
c = _colors_full_map[c]
200200
except KeyError:
201-
try:
202-
c = _colors_full_map[c.lower()]
203-
except KeyError:
204-
pass
205-
else:
206-
if len(orig_c) == 1:
207-
cbook.warn_deprecated(
208-
"3.1", message="Support for uppercase "
209-
"single-letter colors is deprecated since Matplotlib "
210-
"%(since)s and will be removed %(removal)s; please "
211-
"use lowercase instead.")
201+
if len(orig_c) != 1:
202+
try:
203+
c = _colors_full_map[c.lower()]
204+
except KeyError:
205+
pass
212206
if isinstance(c, str):
213207
# hex color in #rrggbb format.
214208
match = re.match(r"\A#[a-fA-F0-9]{6}\Z", c)

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5650,14 +5650,6 @@ def test_annotate_across_transforms():
56505650
arrowprops=dict(arrowstyle="->"))
56515651

56525652

5653-
def test_deprecated_uppercase_colors():
5654-
# Remove after end of deprecation period.
5655-
fig, ax = plt.subplots()
5656-
with pytest.warns(MatplotlibDeprecationWarning):
5657-
ax.plot([1, 2], color="B")
5658-
fig.canvas.draw()
5659-
5660-
56615653
@image_comparison(['secondary_xy.png'], style='mpl20')
56625654
def test_secondary_xy():
56635655
fig, axs = plt.subplots(1, 2, figsize=(10, 5), constrained_layout=True)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.