plotly / plotly/plotly.py

FigureWidget missing update for annotations/static lines

Abierto
#4,318 0 comentarios 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

I use a FigureWidget as container for an updating Figure within JupyterLab. When I update the FigureWidget within a batch_update, the data and the layout overall are updated, but if I introduced a static object like a vline, this persists on the graphic. New executions of the very same FigureWidget instance show the refreshed frame. The properties of the instance itself are also indeed correctly update. Only the old frame in the previous executed cell misses the update on the static lines (but the data and other parts of the layout are correctly update every time as expected).

Here the basic code for reproducing the bug:

import plotly.graph_objects as go
import ipywidgets as wdgt

from plotly import __version__

print(f"Plotly: {__version__}")
print(f"IPywidgets: {wdgt.__version__}")

fig_wdgt = go.FigureWidget()
fig_wdgt

fig = go.Figure()

# fig.add_trace(go.Scatter(x=[1, 2, 3], y=[2, 1, 3]))

# fig.add_vline(x=2, annotation_text="my test line")

with fig_wdgt.batch_update():
    fig_wdgt.data = []
    fig_wdgt.layout = {}

    fig_wdgt.add_traces(fig.data)
    fig_wdgt.layout = fig.layout

and here screenshots with the bug, and suggested use of the code within Jupyter cells:
plotly_screenshot_1

plotly_screenshot_2

I tested the behaviour with python 3.10, Plotly: 5.15.0 and IPywidgets: 8.0.4, on OS, Linux, Windows, and on both Chrome and Edge browsers.

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

Comienza con la reproducción de FigureWidget y batch_update del issue, utilizando en JupyterLab las versiones indicadas de Python, Plotly e ipywidgets. Compara las actualizaciones de los datos, el layout y los objetos estáticos, como vlines; se considera terminado cuando la celda ejecutada anteriormente actualiza sus anotaciones y líneas estáticas sin requerir una nueva ejecución.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.