当前位置:网站首页>dash plotly

dash plotly

2022-07-07 07:50:00 SyncStudy

from dash import Dash, dcc, html
import pandas as pd

app = Dash(name)

df = pd.read_csv (‘robot.txt’, sep =’ ')

df2 = df.set_axis([‘Time’, ‘Power’, ‘Robot’], axis=1, inplace=False)

print(df2[‘Time’])

app.layout = html.Div([
dcc.Graph(
figure=dict(
data=[
dict(
x=df2[‘Time’],
y=df2[‘Power’].loc[df2[‘Robot’]‘robot1’],#df.loc[df[‘column_name’] == some_value]
name=‘Robot 1’,
marker=dict(
color=‘rgb(55, 83, 109)’
)
),
dict(
x=df2[‘Time’],
y=df2[‘Power’].loc[df2[‘Robot’]
‘robot2’],#df.loc[df[‘column_name’] == some_value]
name=‘Robot 2’,
marker=dict(
color=‘rgb(26, 118, 255)’
)
)
],
layout=dict(
title=‘Robot Power’,
showlegend=True,
legend=dict(
x=0,
y=1.0
),
margin=dict(l=40, r=0, t=40, b=30)
)
),
style={‘height’: 300},
id=‘my-graph’
)
])

if name == ‘main’:
app.run_server(debug=True)

原网站

版权声明
本文为[SyncStudy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130648009592.html