Exercise: Wrap your visualizations in functions
Wrap each of the previous visualizations in a function in a python file (e.g. viz.py):
In [ ]:
# Import the functions from your file
from viz import climate_map, legend, timeseries
In [ ]:
# Create your plots with your new functions
climate_map = climate_map()
legend = legend()
timeseries = timeseries()
In [ ]:
# Test the visualizations in the notebook
In [ ]:
from bokeh.plotting import show, output_notebook
In [ ]:
output_notebook()
show(climate_map)
In [ ]:
show(legend)
In [ ]:
show(timeseries)
Exercise: Layout your plots using hplot and vplot
In [ ]:
from bokeh.plotting import vplot, hplot
In [ ]:
# Create layout
map_legend = hplot(climate_map, legend)
layout = vplot(map_legend, timeseries)
In [ ]:
# Show layout
show(layout)
Exercise: Store your layout in an html page
In [ ]:
from bokeh.plotting import output_file
In [ ]:
#output_file("climate.html")
In [ ]:
show(layout)