plotly / plotly/plotly.py

wrong customdata shape in go.Surface

Abierto
#3,308 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug P3
Lenguaje dominante
Python
Estrellas
18.8k
Forks
2.8k
Merge medio
16 h 26 min
PR fusionados (30 d)
21

Descripción

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.

newplot(8)

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comience con la reproducción de Python proporcionada usando go.Surface y arrays de NumPy, centrándose en cómo se consume customdata para las formas no cuadradas de x, y y z. Compare el comportamiento de customdata=angle con customdata=angle.T; el issue estará resuelto cuando el tooltip muestre customdata correctamente a ambos lados de la discontinuidad.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
numpy, python
Área
data-visualization
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.