Set barmode="overlay" in histograms by default to avoid misunderstandings
未关闭
还没有人认领这个 Issue。
feature
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
Reopening of #1865, as asked in the comment.
By default, histograms are not overlayed, which leads to misinterpretation :
import numpy as np
import pandas as pd
import plotly.express as px
x0 = np.random.randn(250)
# Add 1 to shift the mean of the Gaussian distribution
x1 = np.random.randn(250) + 1
df = pd.DataFrame(dict(
series=np.concatenate((["a"] * len(x0), ["b"] * len(x1))),
data=np.concatenate((x0, x1))
))
px.histogram(df, x="data", color="series")
Makes think that there is much more points in red distribution :
While overlying clearly shows that it is just shifted
px.histogram(df, x="data", color="series", barmode="overlay")
This leads to misunderstanding the data shape.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 px.histogram 入口点开始,跟踪当 color 创建多个系列时如何选择 barmode 的默认值。确认默认值变为 overlay,然后使用提供的 pandas 和 NumPy 数据验证示例行为;如果项目覆盖了 histogram 默认值,请添加或更新相关测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100