Scattermode=group does not autoscale yaxis
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
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:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied box-and-scatter example in plotly.py, comparing y-axis autorange with and without scattermode='group'. Trace the scattermode grouping and autorange entry points to identify where the lower bound becomes zero, then add a regression test covering grouped scatter traces with box traces and verify that autorange matches the plotted data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100