plotly / plotly/plotly.py

FigureWidget missing update for annotations/static lines

Đang mở
#4,318 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug P3
Ngôn ngữ chính
Python
Star
18.8k
Fork
2.8k
Merge trung bình
16 giờ 26 phút
Pull request đã merge (30 ngày)
21

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với việc tái hiện FigureWidget và batch_update trong issue, sử dụng các phiên bản Python, Plotly và ipywidgets được nêu trong JupyterLab. So sánh các cập nhật đối với dữ liệu, layout và các đối tượng tĩnh như vlines; được xem là hoàn tất khi ô đã thực thi trước đó làm mới các chú thích và đường tĩnh mà không cần thực thi lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
jupyter-notebook, python
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.