In Plotly, if I add a shared range selector to plot with multiple subplots, it will be misplaced in the middle between the two subplots. you can see the plot here
How can I place the range selector in the bottom of the plot.
Below is the code to generate the plot.
from plotly.subplots import make_subplots
from plotly import graph_objects as go
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv")
df.columns = [col.replace("AAPL.", "") for col in df.columns]
fig = make_subplots(2, 1)
fig.add_trace(
go.Scatter(x=list(df.Date), y=list(df.High)), row=1, col=1)
fig.add_trace(
go.Scatter(x=list(df.Date), y=list(df.Low)), row=2, col=1)
fig.update_layout(
xaxis=dict(
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(step="all")
])
),
rangeslider=dict(
visible=True
),
type="date"
)
)
fig.update_xaxes(matches='x')
fig