plotly / plotly/plotly.py

Aggregate hover data for internal nodes in hierarchical plots

Đang mở
#4,592 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.

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ả

Hierarchical plots constructed with px.treemap, px.icicle, and px.sunburst, aggregate data at internal nodes as follows:

  • values: sum of children,
  • color: values-weighted sum of children if df[color] is numeric, else "discrete aggregation",
  • hover_data: only supports "discrete aggregation",
    where for "discrete aggregation", the value of an internal node is mapped to that of its children if all its children have the same value, otherwise the aggregated value is set to "(?)".

Below is an example of a treemap with 2 quantities in hover data, one of which is numeric and could be aggregated at internal nodes, but instead all non-leaf nodes get a "(?)":

df = px.data.gapminder().query("year == 2007")
df["quantity_to_aggregate"] = np.random.random(df.shape[0])

fig = px.treemap(
    df,
    path=[px.Constant("world"), "continent", "country"],
    values="pop",
    color="lifeExp",
    hover_data=["iso_alpha", "quantity_to_aggregate"],
    color_continuous_scale="RdBu",
    color_continuous_midpoint=np.average(df["lifeExp"], weights=df["pop"]),
)
fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
fig.show()

Capture

Is it possible to aggregate numeric hover_data in hierarchical plots, perhaps as a sum initially, but potentially also giving the option to apply a different function?

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 hành vi biểu đồ phân cấp được mô tả cho px.treemap, px.icicle và px.sunburst, sử dụng ví dụ Gapminder được cung cấp với hover_data dạng số. Xác định cách hover_data hiện được tổng hợp tại các nút bên trong và cách có thể cung cấp một hàm tổng hợp. Công việc được xem là hoàn tất khi các trường hover dạng số được tổng hợp tại các nút bên trong, trong khi các trường rời rạc vẫn giữ hành vi hiện tại và tùy chọn được yêu cầu được hỗ trợ.

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ó
5/5
Thời gian dự kiến
Hơn một tuần
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
25/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.