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

Passing color as tuple not working as expected #4716

Open
juergensturm opened this issue Aug 14, 2024 · 0 comments
Open

Passing color as tuple not working as expected #4716

juergensturm opened this issue Aug 14, 2024 · 0 comments
Labels
bug something broken P3 backlog

Comments

@juergensturm
Copy link

We want to plot colored point clouds. We have the colors as a numpy array of type uint8, but the bug also occurs when we simply pass a list of [r,g,b] values.

We are aware that passing colors as a list of [r,g,b] is not supported, so feel free to close this bug as invalid.
https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.scatter3d.html#plotly.graph_objects.scatter3d.Marker.color

However, the odd thing (and that is unexpected) is that it doesn't yield an error when we pass the colors in this way. However, when one of the values (r/g/b) equals 1, we get the wrong color. This does not happen for 0 or 2 (or any other number).

Minimal example:

import plotly.graph_objs as go

go.Figure().add_trace(go.Scatter3d(x=[1,2,3], y=[1,1,1], z=[1,1,1], mode='markers', marker=dict(color=[[255, 0, 0], [1, 255, 0], [0,  0, 255]], size=10)))

produces red/yellow/blue dots (instead of red/green/blue).

In other cases, we observe that we get white (for example for [1,255,1]).

FWIW, the problem does not occur if we scale the values to 0..1:

import plotly.graph_objs as go

go.Figure().add_trace(go.Scatter3d(x=[1,2,3], y=[1,1,1], z=[1,1,1], mode='markers', marker=dict(color=[[1, 0, 0], [1/255., 1, 0], [0,  0, 1]], size=10)))

renders as expected (red/green/blue).

@gvwilson gvwilson added bug something broken P3 backlog labels Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

2 participants