(doc)
| 11 | |
| 12 | |
| 13 | def bkapp(doc): |
| 14 | df = sea_surface_temperature.copy() |
| 15 | source = ColumnDataSource(data=df) |
| 16 | |
| 17 | plot = figure(x_axis_type='datetime', y_range=(0, 25), |
| 18 | y_axis_label='Temperature (Celsius)', |
| 19 | title="Sea Surface Temperature at 43.18, -70.43") |
| 20 | plot.line('time', 'temperature', source=source) |
| 21 | |
| 22 | def callback(attr, old, new): |
| 23 | if new == 0: |
| 24 | data = df |
| 25 | else: |
| 26 | data = df.rolling('{0}D'.format(new)).mean() |
| 27 | source.data = ColumnDataSource.from_df(data) |
| 28 | |
| 29 | slider = Slider(start=0, end=30, value=0, step=1, title="Smoothing by N Days") |
| 30 | slider.on_change('value', callback) |
| 31 | |
| 32 | doc.add_root(column([slider, plot], sizing_mode='stretch_width')) |
| 33 | |
| 34 | |
| 35 | def main(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…