multiple plots using px line

Solutions on MaxInterview for multiple plots using px line by the best coders in the world

showing results for - "multiple plots using px line"
Louisa
23 Jan 2016
1import plotly.graph_objs as go
2import pandas as pd
3
4#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/wind_speed_laurel_nebraska.csv')
5df = pd.read_excel('/Users/Jakob/Documents/python_notebooks/data/test_excel_import_1.xlsx')
6
7fig = go.Figure([
8    
9    go.Scatter(
10        name='Measurement 1',
11        x=df['Time'],
12        y=df['10 Min Sampled Avg'],
13        mode='markers+lines',
14        marker=dict(color='red', size=2),
15        showlegend=True
16    ),
17    go.Scatter(
18        name='Upper Bound',
19        x=df['Time'],
20        y=df['10 Min Sampled Avg']+df['10 Min Std Dev'],
21        mode='lines',
22        marker=dict(color="#444"),
23        line=dict(width=1),
24        showlegend=False
25    ),
26    go.Scatter(
27        name='Lower Bound',
28        x=df['Time'],
29        y=df['10 Min Sampled Avg']-df['10 Min Std Dev'],
30        marker=dict(color="#444"),
31        line=dict(width=1),
32        mode='lines',
33        fillcolor='rgba(68, 68, 68, 0.3)',
34        fill='tonexty',
35        showlegend=False
36    ),
37    
38    go.Scatter(
39        name='Measurement 2',
40        x=df['Time'],
41        y=df['Velocity'],
42        mode='markers+lines',
43        marker=dict(color='blue', size=2),
44        showlegend=True
45    ),
46    go.Scatter(
47        name='Upper Bound',
48        x=df['Time'],
49        y=df['Velocity']+df['SEM'],
50        mode='lines',
51        marker=dict(color="#444"),
52        line=dict(width=1),
53        showlegend=False
54    ),
55    go.Scatter(
56        name='Lower Bound',
57        x=df['Time'],
58        y=df['Velocity']-df['SEM'],
59        marker=dict(color="#444"),
60        line=dict(width=1),
61        mode='lines',
62        fillcolor='rgba(68, 68, 68, 0.3)',
63        fill='tonexty',
64        showlegend=False
65    )
66])
67fig.update_layout(
68    yaxis_title='Wind speed (m/s)',
69    title='Continuous, variable value error bars',
70    hovermode="x"
71)
72fig.show()
73
74