wrong customdata shape in go.Surface
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 18.8k
- Fork
- 2.8k
- Merge medio
- 16h 26m
- PR unite (30g)
- 21
Descrizione
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.

Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Iniziate con la riproduzione Python fornita usando go.Surface e array NumPy, concentrandovi su come viene utilizzato customdata per le forme non quadrate di x, y e z. Confrontate il comportamento di customdata=angle con quello di customdata=angle.T; l’issue è risolta quando il tooltip visualizza correttamente customdata su entrambi i lati della discontinuità.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- numpy, python
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100