Scattermode=group does not autoscale yaxis
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
I'm plotting some data with a very elaborate box plot series, and attempting to overlay connecting median lines between each box in each series. I can do this successfully, but due the density of information, I need to stagger each x value using boxmode=group and scattermode=group. There are no issues with boxmode, but scattermode causes the lower y min to be set to 0. When scattermode is disabled, everything scales nicely, and when no boxes are drawn, the same issues persists. Using subplots and ensuring shared axes doesn't work, nor does updating axes with autorange.
Code:
`
fig = go.Figure()
point_visibility = point_checked
point_legend = False
box_visibility = True
match box_checked:
case False:
box_visibility = False
point_legend = True
for col in dcr.columns[1:]:
if box_checked:
fig.add_trace(go.Box(
x=dcr['SOC'],
y=dcr[col],
name=col,
legendgroup=col,
visible=box_visibility,
))
if point_checked:
fig.add_trace(go.Scatter(
x=medians['SOC'],
y=medians[col],
name=col,
legendgroup=col,
showlegend=point_legend,
visible=point_visibility,
mode='lines',
))
fig.update_layout(
yaxis_title='DCIR (Ohms)',
xaxis_title='SOC',
boxmode='group',
scattermode='group', # figure out how to align this to the boxes
)
fig.update_yaxes(autorange=True) # has no effect
`
Not scaling:
Disabling scattermode=group (No longer align to boxes):
What it should look like:
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 plotly.py 中复现所提供的 Box-and-Scatter 示例,比较有无 scattermode='group' 时 y 轴的 autorange。跟踪 scattermode 分组和 autorange 的入口点,以确定下限变为零的位置,然后添加一个涵盖分组 scatter traces 与 box traces 的回归测试,并验证 autorange 与绘制的数据一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100