X Tutup
Skip to content

BUG: Fix regression with set_hatchcolor#29427

Merged
timhoffm merged 3 commits intomatplotlib:mainfrom
larsoner:hatch
Jan 7, 2025
Merged

BUG: Fix regression with set_hatchcolor#29427
timhoffm merged 3 commits intomatplotlib:mainfrom
larsoner:hatch

Conversation

@larsoner
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

larsoner commented Jan 7, 2025

Done (I think) @greglucas !

@timhoffm timhoffm merged commit c3567c3 into matplotlib:main Jan 7, 2025
@QuLogic QuLogic added this to the v3.11.0 milestone Jan 7, 2025
@larsoner larsoner deleted the hatch branch May 13, 2025 13:28
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

X Tutup