-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
Description
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()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()Test Environment:
OS: Windows 10
Python Version: 3.12.4
Plotly Version: 5.23.0

