|
|
|
from bokeh.plotting import figure, output_file, save, show
|
|
|
|
from bokeh.models import Legend
|
|
|
|
import pandas as pd
|
|
|
|
import numpy as np
|
|
|
|
from bokeh.models import ColumnDataSource
|
|
|
|
|
|
|
|
x_vals = []
|
|
|
|
y_vals = []
|
|
|
|
file_data = pd.read_csv("data/light-meter-1-daily-totals.csv", sep=",",
|
|
|
|
header=None, index_col=False, dtype='unicode')
|
|
|
|
for row in file_data.values[1:] :
|
|
|
|
x_vals.append(row[0])
|
|
|
|
y_vals.append(row[1])
|
|
|
|
|
|
|
|
x_vals2 = []
|
|
|
|
y_vals2 = []
|
|
|
|
file_data2 = pd.read_csv("data/light-meter-2-daily-totals.csv", sep=",",
|
|
|
|
header=None, index_col=False, dtype='unicode')
|
|
|
|
for row in file_data2.values[1:] :
|
|
|
|
x_vals2.append(row[0])
|
|
|
|
y_vals2.append(row[1])
|
|
|
|
|
|
|
|
data = {'x_values': pd.to_datetime(x_vals),
|
|
|
|
'y_values': np.asarray(y_vals).astype(int),
|
|
|
|
'x_values2': pd.to_datetime(x_vals2),
|
|
|
|
'y_values2': np.asarray(y_vals2).astype(int)}
|
|
|
|
|
|
|
|
source = ColumnDataSource(data=data)
|
|
|
|
|
|
|
|
p = figure(title="Total Daily Reading for Light Meters",
|
|
|
|
x_axis_label="Date",
|
|
|
|
y_axis_label="Total Readings",
|
|
|
|
x_axis_type='datetime',
|
|
|
|
sizing_mode="stretch_both")
|
|
|
|
p.axis.major_label_text_font_size = "12px"
|
|
|
|
p.axis.major_label_standoff = 10
|
|
|
|
|
|
|
|
p.line(x='x_values', y='y_values', source=source,
|
|
|
|
line_color="blue", legend_label="Light Meter 1 (Andy)")
|
|
|
|
p.line(x='x_values2', y='y_values2', source=source,
|
|
|
|
line_color="orange", legend_label="Light Meter 2 (Tony)")
|
|
|
|
|
|
|
|
output_file("output/daily-totals.html", title="Daily Totals")
|
|
|
|
save(p)
|