Skip to content
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

ImageStack should support dictionaries for cmap #6012

Closed
jlstevens opened this issue Dec 7, 2023 · 1 comment · Fixed by #6025
Closed

ImageStack should support dictionaries for cmap #6012

jlstevens opened this issue Dec 7, 2023 · 1 comment · Fixed by #6025
Assignees
Labels
type: bug Something isn't correct or isn't working

Comments

@jlstevens
Copy link
Contributor

This currently works with a list:

import numpy as np
x = np.arange(0, 3)
y = np.arange(5, 8)
a = np.array([[np.nan, np.nan, 1], [np.nan] * 3, [np.nan] * 3])
b = np.array([[np.nan] * 3, [1, 1, np.nan], [np.nan] * 3])
c = np.array([[np.nan] * 3, [np.nan] * 3, [1, 1, 1]])

img_stack = hv.ImageStack((x, y, a, b, c), kdims=["x", "y"], vdims=["a", "b", "c"])
img_stack.opts(cmap=["red", "green", "blue"])

But using a dictionary (which is often more convenient when you don't know the layer order, or need to map a category to a colour) does not work:

import numpy as np
x = np.arange(0, 3)
y = np.arange(5, 8)
a = np.array([[np.nan, np.nan, 1], [np.nan] * 3, [np.nan] * 3])
b = np.array([[np.nan] * 3, [1, 1, np.nan], [np.nan] * 3])
c = np.array([[np.nan] * 3, [np.nan] * 3, [1, 1, 1]])

img_stack = hv.ImageStack((x, y, a, b, c), kdims=["x", "y"], vdims=["a", "b", "c"])
img_stack.opts(cmap={'a':"red", 'b':"green", 'c':"blue"})
@jlstevens jlstevens added the type: bug Something isn't correct or isn't working label Dec 7, 2023
@droumis droumis assigned ahuang11 and unassigned hoxbro Mar 7, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Datashader Inspections Mar 21, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't correct or isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants