px.scatter_3d, use case where color param affects size output
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ả
I have created a scatter3d chart with plotly express. The scatter3d works fine with column "count" as size (fig 1). There are three big bubbles on the top layer and one on the bottom layer.
fig1
I next add the color parameter to be a column "type" in the frame. The resulting plot appears to have incorrectly swapped out "count" for "type" in the size parameter, so now the actual size param is ignored and it maps color to size. (fig 2).
fig2
import pandas as pd
import plotly.express as px
df = pd.DataFrame({
"campaign": ["funny", "funny", "funny", "funny", "patriotic", "patriotic", "patriotic", "patriotic"],
"product": ["classic", "classic", "diet", "diet", "classic", "classic", "diet", "diet"],
"type": ["click", "land", "click", "land", "click", "land", "click", "land"],
"count": [397, 108, 108, 411, 99, 410, 144, 323]
})
fig1 = px.scatter_3d(df, x="campaign", y="product", z="type", hover_data="count").update_traces({"marker": {"size": [j/10 for j in df["count"]]}})
fig2 = px.scatter_3d(df, x="campaign", y="product", z="type", hover_data="count", color="type").update_traces({"marker": {"size": [j/10 for j in df["count"]]}})
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 reproducer được cung cấp cho pandas và plotly.express px.scatter_3d, so sánh fig1 và fig2 sau update_traces. Kiểm tra các giá trị kích thước và màu được tạo cho marker để tìm ra lý do việc thêm color làm thay đổi đầu ra kích thước. Hoàn thành khi kích thước marker suy ra từ số đếm vẫn có hiệu lực khi cung cấp color="type".
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
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100