plotly / plotly/plotly.py

FigureWidget missing update for annotations/static lines

Aperta
#4,318 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug P3
Lingua principale
Python
Stelle
18.8k
Fork
2.8k
Merge medio
16h 26m
PR unite (30g)
21

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la riproduzione di FigureWidget e batch_update riportata nell’issue, utilizzando in JupyterLab le versioni indicate di Python, Plotly e ipywidgets. Confronta gli aggiornamenti ai dati, al layout e agli oggetti statici come vlines; il lavoro è completato quando la cella eseguita in precedenza aggiorna le proprie annotazioni e linee statiche senza richiedere una nuova esecuzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
jupyter-notebook, python
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.