-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: matplotlib.colors.LinearSegmentedColormap.from_list doesn't work with hex representation of colors #27029
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
Do you know what version this used to work with? |
It worked last in 3.7.0. I think the problem is colors.to_rgba_array when
In this case with my color list Indeed, if I add a third color, the problem disappears. |
The original issue #26949 also used hexes but the failure path was the same regardless of whether I tried the hex representation or the abbreviated (“k”, “w”) colour representation. So I do not think we need an extra test to cover the hex version of this bug, but obviously I’m biased as it was my PR 🙂 |
Thanks for the report. This will be fixed in the next bug release. |
Bug summary
For some reason colors.LinearSegmentedColormap.from_list stopped working with colors such as '#E3DBCC', when in previous versions it used to work.
It raises an error in
to_rgba_array(colors)
, but when actually callingcolors.to_rgba_array(['#E3DBCC'])
it works just fine.Code for reproduction
Actual outcome
Expected outcome
I expect the LinearSegmentedColormap to be created successfully.
Additional information
No response
Operating system
OS X 13.1
Matplotlib Version
3.8.0
Matplotlib Backend
'module://matplotlib_inline.backend_inline'
Python version
3.9
Jupyter version
3.6.1
Installation
conda
The text was updated successfully, but these errors were encountered: