FigureWidget missing update for annotations/static lines
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中的 FigureWidget 和 batch_update 复现开始,在 JupyterLab 中使用其中指定的 Python、Plotly 和 ipywidgets 版本。比较对数据、布局以及 vlines 等静态对象的更新;当之前执行过的单元格无需重新执行即可刷新其注释和静态线条时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- jupyter-notebook, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100