wrong customdata shape in go.Surface
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
It appears that I have found a bug when using customdata with go.Surface. In the following example, I have discretized two directions with a different number of points. The tooltip is going to visualize information coming from x, y, z coordinates as well as customdata.
import numpy as np
import plotly.graph_objects as go
import plotly.express as px
x = np.linspace(-3, 3, 50)
y = np.linspace(-5, 5, 100)
x, y = np.meshgrid(x, y)
z = np.sqrt(x + 1j * y)
angle = np.angle(z)
z = np.absolute(z)
fig = go.Figure()
skw = dict(
showscale=True,
colorbar=dict(
title="Argument",
titleside="right",
tickvals = [
-np.pi,
-np.pi / 2,
0,
np.pi / 2,
np.pi,
],
ticktext = [
"-π",
"-π / 2",
"0",
"π / 2",
"π",
]
),
cmin = -np.pi,
cmax = np.pi,
colorscale=px.colors.sequential.Rainbow,
surfacecolor=angle,
customdata=angle,
hovertemplate="x: %{x}<br />y: %{y}<br />Abs: %{z}<br />Arg: %{customdata}",
)
fig.add_trace(
go.Surface(x=x, y=y, z=z, **skw)
)
fig
This is the output picture. You can see a discontinuity at y=0. However, if you move the mouse on the right of the discontinuity, customdata won't show up.
On the other hand, if I'm going to use customdata=angle.T, than the tooltip will show the correct data.
I believe that customdata should have the same shape as the x, y, z coordinates.

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 with the provided Python reproduction using go.Surface and NumPy arrays, focusing on how customdata is consumed for the non-square x, y, and z shapes. Compare the behavior of customdata=angle with customdata=angle.T; the issue is done when the tooltip displays customdata correctly on both sides of the discontinuity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100