-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: no longer able to set multiple hatch colors #28990
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
Comments
This comes in through #25247, which aggregates all contours in one Collection rather than having a separate Collection per contour. While the old approach set one color per collection, the new approach requires setting individual colors per item in the collection. Conceptually, that should be possible, and I believe, the culprit is the special-casing for hatches in matplotlib/lib/matplotlib/contour.py Lines 1255 to 1269 in 9489b93
one gets different edge colors when removing the hatching. The hatch case has to be extended to loop through edgecolors. |
It seems that previously if you wanted different hatch colours you also had to accept coloured edges on the contours. Is that the desired behaviour? I’m thinking since |
Separating hatch color from edge color is a separate topic. See #26074 and the PRs linked therein. |
Bug summary
Possible bug or maybe a usage issue following some recent updates...
In short, it used to be possible to set the hatch color for each filled contour area to a different color by iterating over the collections and then setting the edgecolor for each, but that's no longer the case with Matplotlib 3.10 and the removal of collections.
I've been trying to find a workaround after the recent updates, but am struggling a bit. Using
set_edgecolors
only sets a single hatch color for all filled contours (which seems unexpected based upon the docs and like a potential bug) and rcParams['hatch.color'] also just sets a single color (less suprising).It's entirely possible I'm missing something here, but didn't see much in the docs to help either.
Code for reproduction
Actual outcome
Expected outcome
Additional information
No response
Operating system
OS/X
Matplotlib Version
3.9.2
Matplotlib Backend
'module://matplotlib_inline.backend_inline'
Python version
3.11.7
Jupyter version
4.0.9
Installation
conda
The text was updated successfully, but these errors were encountered: