plotly.graph_objects.sankey.node.Line does not work with an array of color
Chưa có ai nhận issue này.
- 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ả
Hi everyone,
The docs says that the argument color either takes a color or an array of colors. However, when I pass an array of colors, it always shows up black instead of the specified color. Here is a code example that does the bug :
import plotly.graph_objects as go
# define the node labels and colors
node_labels = ["A", "B", "C", "D"]
node_colors = ["red", "blue", "green", "purple"]
#Array of colors for the node's line
node_line_colors = ["black", "gray", "orange", "yellow"]
# define the links between the nodes
link_source = [0, 0, 1, 1, 2, 2]
link_target = [1, 2, 2, 3, 0, 3]
link_value = [8, 4, 2, 6, 10, 12]
# create the Sankey diagram
fig = go.Figure(data=[go.Sankey(
node=dict(
label=node_labels,
color=node_colors,
line=dict(
color=node_line_colors, # Colors I want to have for my diagram
width=10 # Bigger to properly see that the colors aren't here
)
),
link=dict(
source=link_source,
target=link_target,
value=link_value
)
)])
fig.show()
I also tried to manually add the colors like this instead of using the constructor :
fig.data[0]['node']['line']['color'] = node_line_colors
But the node's lines still show up black instead of coloried.
Expected result :
black line for A node,
gray line for B node,
green line for C node,
purple line for D node ;
Actual result :

Thanks,
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- 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ụ go.Sankey được cung cấp và so sánh hành vi mảng được mô tả trong tài liệu với các đường của node được hiển thị. Theo dõi cách node.line.color được xử lý khi được truyền qua constructor Sankey, sau đó xác minh rằng bốn màu được mong đợi được hiển thị trên các node tương ứ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ệ
- 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