wrong customdata shape in go.Surface
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
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.

Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der bereitgestellten Python-Reproduktion unter Verwendung von go.Surface und NumPy-Arrays und konzentrieren Sie sich darauf, wie customdata für die nicht quadratischen Formen von x, y und z verwendet wird. Vergleichen Sie das Verhalten von customdata=angle mit customdata=angle.T; das Issue ist erledigt, wenn der Tooltip customdata auf beiden Seiten der Diskontinuität korrekt anzeigt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- numpy, python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100