in flask/utils.py [0:0]
def plot_data(data, anomalies, title, x_label, y_label):
"""
Plots statistics
:param data: The data
:param title: Title of the graph (string)
:param x_label: X-axis label (string)
:param y_label: Y-axis label (string)
:param width: Width of table (integer)
:param height: Height of table (integer)
:return: Bokeh Figure object
"""
data['alpha1'] = data['mav'] + (2 * data['mstd'])
data['alpha2'] = data['mav'] - (2 * data['mstd'])
y_range = [min(data['mav']) - (5 * data['obs'].std()), max(data['mav']) + (5 * data['obs'].std())]
source = ColumnDataSource(data)
source2 = ColumnDataSource(anomalies)
p = figure(title=title, x_axis_label=x_label, y_axis_label=y_label, plot_width=1200, plot_height=600,
x_axis_type='datetime', y_range=y_range)
p.circle(x='timestamp', y='obs', source=source, size=5, legend="Observation")
p.line(x='timestamp', y='mav', source=source, line_width=1, color="purple", legend="Moving Average")
p.line(x='timestamp', y='alpha1', source=source, line_width=2, color="red", line_dash="dashed",
legend="95% Confidence Interval")
p.line(x='timestamp', y='alpha2', source=source, line_width=2, color="red", line_dash="dashed")
p.circle(x='timestamp', y='obs', source=source2, size=5, color="firebrick", legend="Anomaly")
p.legend.label_text_font_size = "8pt"
return p