plotly / plotly/plotly.py

add option to add "select" mode on any figure (specifically, Heatmap)

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

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

feature 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ả

It doesn't seem possible to add a "select" dragmode to a figure with a go.Heatmap object. You can specify the starting dragmode as "select", in which case you can immediately drag and select. But if I wanted to pan, I can't choose to select afterwards. I cannot add it to the modebar. I would like to be able to do this so I can select a region of interest on my heatmap, and setup a callback to set this region of interest in my code. I don't care about actually selecting the points in the heatmap, just the bounds of the selection box.

My workaround to this is to add a go.Scatter to my figure:

layout =  go.Layout(
        showlegend=False,
        autosize=False,
        xaxis=dict(
            showgrid=False,
            zeroline=False,
            visible=False,
            range=[0, images.shape[2] - 1],
        ),
        yaxis=dict(
            showgrid=False,
            zeroline=False,
            visible=False,
            range=[images.shape[1] - 1, 0],
            scaleanchor="x",
            scaleratio=1,
        ),
        dragmode="zoom",
        modebar=go.layout.Modebar(remove=["lasso"]),
    )

heat = go.FigureWidget(
    data=[
        go.Scatter(
            x=[0],
            y=[0],
        ),
        go.Heatmap(z=current_image, colorscale="Viridis"),
    ],
    layout=layout,
)

This works, but is kind of silly...

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 ví dụ go.FigureWidget, tập trung vào layout.dragmode, các tùy chọn của modebar và tương tác với go.Heatmap được mô tả trong issue. Kiểm tra cách các callback lựa chọn và các giới hạn lựa chọn được cung cấp khi figure chỉ chứa một Heatmap. Hoàn thành khi có thể chuyển đổi giữa pan hoặc zoom và select thông qua modebar mà không cần thêm một go.Scatter giả.

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

Đánh giá

Công nghệ
python
Lĩnh vực
data-visualization
Loại issue
Tính năng
Độ 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
38/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.