Skip to content

Updating xaxis_range changes y-axis range for px.scatter when marginals are displayed. #4643

Open
@GabrielKP

Description

@GabrielKP

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:
working

The second fig.show() produces:
bugged

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions