Skip to content

[Bug]: Tick class instantiation returns an error when labelcolor is a tuple #26588

@jpdehollain

Description

@jpdehollain

Bug summary

I have a function that uses custom colouring of different plot axes. When Matplotlib tries to render the figure, I am getting the following error shown below

Code for reproduction

Set the tick label color of a plot using a tuple and try to render.

Actual outcome

File [c:\Users\AppData\Local\miniconda3\lib\site-packages\matplotlib\axis.py:125](file:///C:/Users/v-jpd/AppData/Local/miniconda3/envs/laptop-2.2.91/lib/site-packages/matplotlib/axis.py:125), in Tick.__init__(self, axes, loc, size, width, color, tickdir, pad, labelsize, labelcolor, zorder, gridOn, tick1On, tick2On, label1On, label2On, major, labelrotation, grid_color, grid_linestyle, grid_linewidth, grid_alpha, **kwargs)
    [122] if labelcolor is None:
    [123]     labelcolor = mpl.rcParams[f"{name}.labelcolor"]
--> [125] if labelcolor == 'inherit':
    [126]     # inherit from tick color
    [127]     labelcolor = mpl.rcParams[f"{name}.color"]
    [129] if labelsize is None:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Expected outcome

Plot with custom tick-label colors.

Additional information

No response

Operating system

Windows

Matplotlib Version

3.7.2

Matplotlib Backend

Have tried with inline and qt

Python version

No response

Jupyter version

3.10.12

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions