i have the following code that draws a time-series plot with range slider.
import plotly.express as px
fig = px.line(returns, x='date', y='value', title='Growth of 10k', )
fig.update_layout(updatemenus=[
dict(
buttons=[
dict(label="Linear", method="relayout", args=[{"yaxis.type": "linear"}]),
dict(label="Log", method="relayout", args=[{"yaxis.type": "log"}]),
])]
)
fig.update_xaxes(
rangeslider_visible=True,
rangeselector=dict(
buttons=list([
dict(count=1, label="1m", step="month", stepmode="backward"),
dict(count=6, label="6m", step="month", stepmode="backward"),
dict(count=1, label="YTD", step="year", stepmode="todate"),
dict(count=1, label="1y", step="year", stepmode="backward"),
dict(count=3, label="3y", step="year", stepmode="backward"),
dict(count=5, label="5y", step="year", stepmode="backward"),
dict(step="all")
])
)
)
fig.show()
ht = plotly.offline.plot(fig, output_type="div", config={'displayModeBar': False})
return ht
which produces the following graph:
by moving the x-axis range slider the portion of the data displayed will also change as well which is what I want, but on the y axis, the range doesnβt change and stays the same is apparent from the following:
my question is that is there anything I can do to make sure that the series always starts at a specific number at the y axis? like in the second picture instead of having the series start at 3M on the y-axis I want it to always start at 10k. i donβt want to do any data recalculations and i only want the y-axis labels to change accordingly.