我有一个使用范围选择器的子图。
fig = make_subplots(rows = 2, cols = 1)
fig.add_trace(
go.Scatter(x=list(df.Date), y=list(df.Measure)), row = 1, col = 1)
fig.add_trace(
go.Scatter(x=list(dfsecond.Date), y=list(dfsecond.Measure)), row = 2, col = 2)
fig.update_layout(
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label="1m",
step="month",
stepmode="backward")
])
),
rangeslider=dict(
visible=True
),
type="date"
)
)
范围选择器按钮出现两次。它们在第一行出现一次,在第二行再次出现。我希望范围选择器在第一行只出现一次。
So this is what I did for my project and it has time period buttons for stock
charts and I edited your code to look just like mine and this worked for me with
3 rows of charts below my main chart, which is where the buttons are. Here is
the code:
fig.update_layout(
xaxis=dict(
rangeselector_visible=True,
rangeselector=dict(
buttons=list([
dict(count=1,
label="1m",
step="month",
stepmode="backward")
]),
)
))