From 7b84f265b6b4ec4dc8fdc2a73d22bc8f77599e90 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Mon, 28 Aug 2023 14:01:17 -0500 Subject: [PATCH] Backport PR #26598: FIX: array labelcolor for Tick --- lib/matplotlib/axis.py | 2 +- lib/matplotlib/tests/test_axis.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 lib/matplotlib/tests/test_axis.py diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index ecaa7ddf7964..05b4a7d1034e 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -122,7 +122,7 @@ def __init__( if labelcolor is None: labelcolor = mpl.rcParams[f"{name}.labelcolor"] - if labelcolor == 'inherit': + if cbook._str_equal(labelcolor, 'inherit'): # inherit from tick color labelcolor = mpl.rcParams[f"{name}.color"] diff --git a/lib/matplotlib/tests/test_axis.py b/lib/matplotlib/tests/test_axis.py new file mode 100644 index 000000000000..97b5f88dede1 --- /dev/null +++ b/lib/matplotlib/tests/test_axis.py @@ -0,0 +1,10 @@ +import numpy as np + +import matplotlib.pyplot as plt +from matplotlib.axis import XTick + + +def test_tick_labelcolor_array(): + # Smoke test that we can instantiate a Tick with labelcolor as array. + ax = plt.axes() + XTick(ax, 0, labelcolor=np.array([1, 0, 0, 1]))