I have this code:
from datetime import timedelta, datetime
def plot_values(times, values, index_names):
fig = make_subplots(rows=1, cols=2, start_cell="bottom-left")
for i in range(len(times)):
fig.add_trace(go.Scatter(x=times[i], y=values[i], name=index_names[i]),
row=1,
col=1)
fig.add_trace(go.Scatter(x=list(range(len(times))), y=values[i], name=index_names[i]),
row=1,
col=2)
fig = fig.update_traces(visible="legendonly")
fig.show()
values = [[i for i in range(10)],
[i + 1 for i in range(10)]]
times = [[datetime.now() + timedelta(minutes=i) for i in range(10)],
[datetime.now() + timedelta(minutes=5) + timedelta(minutes=i) for i in range(10)]]
names = ["name " + str(i) for i in range(10)]
plot_values(times, values, names)
This code duplicate the indexes.
how can I combine the 2 subplots to have only 2 indexes: name 0
and name 1
.