Color of Contour lines in Surfaces with colormap are not correctly set
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
I think there is an issue in the way the lines plot by a contours in a Surface object when selecting the color.
I think the color is not being correctly selected by each of the lines. They are supposed to follow the colorscale, but they just follows half of it.
Here there is a minimum example of code to simulate the error:
import numpy as np
import plotly.graph_objects as go
x = np.linspace(0, 1, 100)
y = np.linspace(0, 1, 100)
x_grid, y_grid = np.meshgrid(x, y)
z = x_grid + y_grid
params = {
'colorscale': 'rainbow',
'surfacecolor': z,
'showscale': True,
'colorbar': {
'title': 'z',
},
'contours_z': {
'show': True,
'usecolormap': True,
"project_z": True,
}
}
trace = go.Surface(
x=x,
y=y,
z=z,
**params)
fig = go.Figure(data=[trace])
fig.write_image("test.png")
fig.show()
In the example, the expected behavior will be for the contour lines to be the same color as the surface, but they are not.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Python minimum example with plotly.graph_objects.Surface and contours_z enabled, comparing the contour colors with the surface colorscale. Trace the Surface contour-coloring path and verify that the contour lines use the full selected colorscale; done means the contour lines match the corresponding surface colors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100