# import ipywidgets as widgets
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
# :TODO: general case, look for all the files with the same venue number and plot together,
# loop over them, and do this in the main book; get location from the file itself.
df1 = pd.read_csv("./venue-2/venue_2_with_device_4855191225C3.csv")
# df2 = pd.read_csv("./venue-2/venue_2h_with_device_58BF25DB81A1-unscaled.csv")
df3 = pd.read_csv("./venue-2/venue_2le_with_device_58BF25DB81A1.csv")
df1 = df1[(df1.temperature >-10)] # eliminate rogue data
# df2 = df2[(df2.temperature >-10)] # eliminate rogue data
df3 = df3[(df3.temperature >-10)] # eliminate rogue data
trace1 = go.Scatter(customdata=df1,
y=df1['temperature'],
x = df1['timestamp'],
mode='lines',
hoverinfo='all',
name='worship space',
)
# trace2 = go.Scatter(customdata=df2,
# y=df2['temperature'],
# x = df2['timestamp'],
# mode='lines',
# hoverinfo='all',
# name='hall',
# )
trace3 = go.Scatter(customdata=df3,
y=df3['temperature'],
x = df3['timestamp'],
mode='lines',
hoverinfo='all',
name='by lectern',
)
g = go.FigureWidget(data=[trace1,trace3], # omit trace 2
layout = go.Layout(
yaxis=dict(range=[-3,25])
))
fig = go.Figure(g)
fig.update_layout(showlegend=True,
autosize = True,
width=1000,
height=500,
)
fig.update_layout(
hovermode='x unified',
# range=[range_min, range_max],
hoverlabel=dict(
bgcolor="white",
# font_size=16,
font_family="Rockwell"
)
)
#Add range slider
fig.update_layout(
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(
label="All",
step="all"
),
dict(count=1,
label="Hour",
step="hour",
stepmode="todate"),
dict(count=1,
label="Day",
step="day",
stepmode="backward"),
dict(count=7,
label="Week",
step="day",
stepmode="backward"),
dict(count=1,
label="Year",
step="year",
stepmode="backward")
])
),
rangeslider=dict(
visible=True,
),
type="date"
)
)
#fig.add_hline(y=16, annotation_text='16C - usual minimum for children', annotation_font_color="blue", line_color='red', layer='above', line_dash='dash')
# fig.update_yaxes(range = [-5, dfCollatedDataSet['temperature'].max()+5])
fig.show()