import pandas as pd
import plotly.graph_objs as go
from plotly.subplots import make_subplots
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(1, 2)
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=1, col=2)
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"
)
)
import plotly.offline as pyo
pyo.plot(fig)
I want to create one common slider for both of the plots. Currently there are two graphs but slider is working only for one of them. Is it possible to make the current slider common for all the multiple graphs in a subplot?