欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

dashplotly

时间:2023-05-25

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)

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。