Updating `xaxis_range` changes y-axis range for `px.scatter` when marginals are displayed.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
Problem
When using px.scatter and displaying both marginals, updating the xaxis_range will change the yaxis_range such that data will be cut off.
Changing the yaxis_range works as expected.
The bug only occurs when using both marginals.
I am using the current latest version 5.22.0.
Code
import plotly.express as px
# figure normal
fig = px.scatter(
x=[3, 37, 37, 69],
y=[1.8, 3.9, 2.7, 4.8],
marginal_x="histogram",
marginal_y="histogram",
)
fig.show()
# x axis is modified correctly
# but y axis is modified too
fig.update_layout(xaxis_range=[0, 185])
fig.show()
The first fig.show() produces:
The second fig.show() produces:
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 running the provided Python reproduction with px.scatter and both marginal histograms, then inspect how the resulting figure handles xaxis_range and yaxis_range. Done means changing xaxis_range no longer changes or clips the y-axis range, with a regression test covering both marginals.
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