Reputation: 229
I am using plotly library to plot my line chart.
Currently my x-axis has a limit from 0 to 10G (10 Billion) with equal divisions / intervals.
fig.update_xaxes(visible=True, range=[0,10000000000])
Is there any way I can change the x-axis label to increase in multiples of 10 like the image below instead of having equal intervals?
Upvotes: 2
Views: 370
Reputation: 61104
If you're looking for built-in options:
fig.update_xaxes(type="log")
...will give you this:
...instead of this:
'
import plotly.graph_objects as go
import plotly.express as px
df = px.data.gapminder().query("year == 2007")
fig = go.Figure()
fig.add_trace(go.Scatter(mode="markers", x=df["gdpPercap"], y=df["lifeExp"] ))
fig.update_xaxes(type="log")
fig.show()
Upvotes: 1