FigureWidget missing update for annotations/static lines
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
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:
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.
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
Beginne mit der FigureWidget- und batch_update-Reproduktion aus dem Issue und verwende dabei die angegebenen Versionen von Python, Plotly und ipywidgets in JupyterLab. Vergleiche Aktualisierungen an Daten, Layout und statischen Objekten wie vlines. Als erledigt gilt die Aufgabe, wenn die zuvor ausgeführte Zelle ihre Annotationen und statischen Linien aktualisiert, ohne dass eine erneute Ausführung erforderlich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- jupyter-notebook, python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100