px.scatter_3d, use case where color param affects size output
未关闭
还没有人认领这个 Issue。
bug
P2
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
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"]]}})
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行提供的 pandas 和 plotly.express px.scatter_3d reproducer,并比较 update_traces 之后的 fig1 和 fig2。检查生成的标记大小和值颜色,以找出添加 color 后大小输出发生变化的原因。当提供 color="type" 时,基于计数得出的标记大小仍然有效,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 68/100