Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When only one value is set for xaxis.range, the other value becomes invalid. #4720

Open
trouver opened this issue Aug 19, 2024 · 0 comments
Open
Labels
bug something broken P3 not needed for current cycle

Comments

@trouver
Copy link

trouver commented Aug 19, 2024

If one of the values for xaxis.range is set to None, the other set value will not take effect. Both values for xaxis.range need to be set simultaneously to be effective. The same issue does not occur with yaxis.range.

In the following code, setting the first value of xaxis.range to None and the second value to 100 does not set the x-axis range to [0, 100].

import plotly.express as px


df = {'fruit': ['banana', 'orange', 'apple'], 'price': [10, 20, 30]}
fig = px.bar(df, x='price', y='fruit')
fig.update_layout(xaxis={'range': [None, 100]})
fig.show()

fig1

In the code below, with both values of xaxis.range set, it works correctly.

import plotly.express as px


df = {'fruit': ['banana', 'orange', 'apple'], 'price': [10, 20, 30]}
fig = px.bar(df, x='price', y='fruit')
fig.update_layout(xaxis={'range': [0, 100]})
fig.show()

fig2

Test Environment:

OS: Windows 10
Python Version: 3.12.4
Plotly Version: 5.23.0

@gvwilson gvwilson added bug something broken P3 not needed for current cycle labels Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

2 participants