Кто-то из Плотских Форм ответил на мой вопрос. Вот что я сделал.
import plotly
import plotly.graph_objects as go
import numpy as np
import pandas as pd
import plotly.express as px
from plotly.subplots import make_subplots
import chart_studio.plotly as py
import random
df = pd.DataFrame({'A':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'B':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'C':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'D':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'E':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'F':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'G':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'H':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'I':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'J':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'K':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'L':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'M':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'N':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'O':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'P':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)]
})
df2 = pd.DataFrame({'A':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'B':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'C':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'D':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'E':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'F':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'G':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'H':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'I':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'J':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'K':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'L':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'M':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'N':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'O':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)],
'P':[random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200),random.randint(1,200)]
})
fig = make_subplots(rows=2, cols=1,shared_xaxes=True,vertical_spacing = 0.25)
# Add traces, one for each slider step
for step in range(len(df.index)):
fig.append_trace(
go.Scatter(
visible=False,
line=dict(color="#00CED1", width=2),
name="Time = " + str(step),
x=df.columns[0:],
y=df.loc[step]),row=1, col=1)
#for step in range(len(df2.index)):# Tried this does not work
fig.append_trace(
go.Scatter(
visible=False,
line=dict(color="red", width=2),
name="Time = " + str(step),
x=df2.columns[0:],
y=df2.loc[step]),row=2, col=1)
# Create and add slider
steps = []
for i in range(0, len(fig.data), 2):
step = dict(
method="restyle",
args=["visible", [False] * len(fig.data)],
)
step["args"][1][i:i+2] = [True, True]
steps.append(step)
sliders = [dict(
active=0,
currentvalue={"prefix": "Time: "},
pad={"t": 50},
steps=steps
)]
fig.update_yaxes(title_text="Temperature", range=[-160, 260],nticks=30, row=1, col=1)
fig.update_yaxes(title_text="Pressure", range=[-169, 260],nticks=30, row=2, col=1)
fig.update_layout(sliders=sliders, title="Time Series - Interactive", template ="plotly_white")
plotly.offline.plot(fig, filename='name.html')
fig.show()