Skip to content

BUG: Fix regression with set_hatchcolor #29427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 7, 2025
Merged

Conversation

larsoner
Copy link
Contributor

@larsoner larsoner commented Jan 7, 2025

Fixes a regression introduced in #28104 (cc @timhoffm @Impaler343 ):

>>> import numpy as np
>>> import matplotlib.patches
>>> rect = matplotlib.patches.Rectangle([0, 0], 1, 1)
>>> rect.set_hatchcolor(np.zeros(3))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/larsoner/python/matplotlib/lib/matplotlib/patches.py", line 445, in set_hatchcolor
    self._set_hatchcolor(color)
  File "/home/larsoner/python/matplotlib/lib/matplotlib/patches.py", line 428, in _set_hatchcolor
    if color == 'edge':
       ^^^^^^^^^^^^^^^
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

larsoner and others added 2 commits January 7, 2025 10:48
Co-authored-by: Greg Lucas <greg.m.lucas@gmail.com>
@larsoner
Copy link
Contributor Author

larsoner commented Jan 7, 2025

Done (I think) @greglucas !

@timhoffm timhoffm merged commit c3567c3 into matplotlib:main Jan 7, 2025
35 of 36 checks passed
@QuLogic QuLogic added this to the v3.11.0 milestone Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants