diff --git a/doc/api/api_changes_3.3/behaviour.rst b/doc/api/api_changes_3.3/behaviour.rst index 7549920d1d35..70a02d81b9d4 100644 --- a/doc/api/api_changes_3.3/behaviour.rst +++ b/doc/api/api_changes_3.3/behaviour.rst @@ -208,3 +208,9 @@ Passing Line2D's *drawstyle* together with *linestyle* is removed Instead of ``plt.plot(..., linestyle="steps--")``, use ``plt.plot(..., linestyle="--", drawstyle="steps")``. ``ds`` is also an alias for ``drawstyle``. + +Upper case color strings +~~~~~~~~~~~~~~~~~~~~~~~~ + +Support for passing single-letter colors (one of "rgbcmykw") as UPPERCASE +characters is removed; these colors are now case-sensitive (lowercase). diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index d461768d737d..ad88ea6052d8 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -198,17 +198,11 @@ def _to_rgba_no_colorcycle(c, alpha=None): # This may turn c into a non-string, so we check again below. c = _colors_full_map[c] except KeyError: - try: - c = _colors_full_map[c.lower()] - except KeyError: - pass - else: - if len(orig_c) == 1: - cbook.warn_deprecated( - "3.1", message="Support for uppercase " - "single-letter colors is deprecated since Matplotlib " - "%(since)s and will be removed %(removal)s; please " - "use lowercase instead.") + if len(orig_c) != 1: + try: + c = _colors_full_map[c.lower()] + except KeyError: + pass if isinstance(c, str): # hex color in #rrggbb format. match = re.match(r"\A#[a-fA-F0-9]{6}\Z", c) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 53bc10b15b3d..030615286461 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -5650,14 +5650,6 @@ def test_annotate_across_transforms(): arrowprops=dict(arrowstyle="->")) -def test_deprecated_uppercase_colors(): - # Remove after end of deprecation period. - fig, ax = plt.subplots() - with pytest.warns(MatplotlibDeprecationWarning): - ax.plot([1, 2], color="B") - fig.canvas.draw() - - @image_comparison(['secondary_xy.png'], style='mpl20') def test_secondary_xy(): fig, axs = plt.subplots(1, 2, figsize=(10, 5), constrained_layout=True)