plotly / plotly/plotly.py

Weird Sankey cycles when nodes are positionned and not ordered by increasing x values

Đang mở
#3,568 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 had some strange looking arrows in a Sankey (Plotly v 5.5.0), involving loops. The exact same problem was raised here. After trying different things, I found out the problem occured only when using node positions, and if the nodes in a given loop are not ordered by ascending 'x' position. You may give it a try with this very basic example:

import plotly.graph_objects as go
fig = go.Figure(go.Sankey(
    node = {"label": ["First node", "Last node"],
        "x": [0.6, 0.2],
        "y": [0.2, 0.6]},
    link = {
        "source": [0, 1],
        "target": [1, 0],
        "value":  [1, 1]
}))
fig.show()

And then replacing the "x" line by:
"x": [0.2, 0.6],
This looks like a bug, which should be fixed ideally. In the meantime, I strive to first order my nodes by ascending X position, which is rather tedious, since I already have to remove nodes without links (or 0 value links) as explained in other open issues. This involves quite a bit of pre-processing unfortunately.

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ụ Sankey tối thiểu bằng Python trong issue và so sánh hai thứ tự x của các node. Theo dõi đường dẫn render Sankey để xác định tại sao các vị trí bị đảo ngược lại tạo ra các mũi tên vòng lặp bị hỏng; hoàn thành nghĩa là cả hai thứ tự đều render cycle chính xác mà không yêu cầu caller sắp xếp lại các node.

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
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 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
45/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.