plotly / plotly/plotly.py

`on_selection` callback seems to not get fired

Đang mở
#3,910 3 bình luận 1 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ả

Thanks for your interest in Plotly.py!

Before opening an issue, please search for existing and closed issues :)

Please accompany bug reports with a reproducible example. Please use the latest version of plotly.py in your report unless not applicable.

Note that GitHub Issues are meant to be used for bug reports and feature requests only. Implementation or usage questions should be asked on community.plotly.com or on Stack Overflow (tagged plotly).

It seems the on_selection callback does not fire anymore. I've seen a number of open and closed issues back from 2020 discussing the usage of it, but based on the newest version 5.10.0 I cannot get anything to fire on a selection.

The simplest code example I could find (from https://github.com/plotly/plotly.py/issues/2698)


import plotly.graph_objects as go
import numpy as np

np.random.seed(1)
x = np.random.randn(500)

def on_selection_print(obj, points, selector):
    print(points.point_inds)

figure_widget = go.FigureWidget(data=[go.Histogram(x=x)])
figure_widget.update_layout(dragmode="select")    
figure_widget.data[0].on_selection(on_selection_print)
figure_widget.show()

Both running this in jupyter or as a python script, nothing seems to print.

I tried the latest docs on selection events but I couldn't actually get that example to run in jupyter or otherwise.

Am I just missing something simple?

Thanks!

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 bằng cách chạy ví dụ FigureWidget được cung cấp trong Jupyter và dưới dạng một tập lệnh Python, tập trung vào callback on_selection của figure và thiết lập dragmode="select". Theo dõi đường đi của sự kiện chọn và so sánh hành vi với tài liệu về các sự kiện chọn được liên kết và issue #2698; được xem là hoàn tất khi hành vi của callback được giải thích và ví dụ được báo cáo đã được sửa hoặc cách sử dụng được hỗ trợ của nó được xác lập rõ ràng.

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
Ít trao đổi
Độ rõ ràng
Cần làm rõ
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.