Book Image

Hands-On Data Visualization with Bokeh

By : Kevin Jolly
Book Image

Hands-On Data Visualization with Bokeh

By: Kevin Jolly

Overview of this book

Adding a layer of interactivity to your plots and converting these plots into applications hold immense value in the field of data science. The standard approach to adding interactivity would be to use paid software such as Tableau, but the Bokeh package in Python offers users a way to create both interactive and visually aesthetic plots for free. This book gets you up to speed with Bokeh - a popular Python library for interactive data visualization. The book starts out by helping you understand how Bokeh works internally and how you can set up and install the package in your local machine. You then use a real world data set which uses stock data from Kaggle to create interactive and visually stunning plots. You will also learn how to leverage Bokeh using some advanced concepts such as plotting with spatial and geo data. Finally you will use all the concepts that you have learned in the previous chapters to create your very own Bokeh application from scratch. By the end of the book you will be able to create your very own Bokeh application. You will have gone through a step by step process that starts with understanding what Bokeh actually is and ends with building your very own Bokeh application filled with interactive and visually aesthetic plots.
Table of Contents (10 chapters)

Creating multiple plots in a row and column

We might see a situation in which we would like to compare the two scatter plots horizontally, but would like the time series plot to be stacked here with the scatter plots, but all within the embrace of the same layout.

Such a combination of horizontal and vertical layouts is called a nested layout.

We can construct a nested layout by using the code shown here:

#Import the required packages

from bokeh.layouts import column, row
from bokeh.io import output_file, show

#Construct the nested layout

nested_layout = column(row(plot1,plot2), plot3)

#Output the plot

output_file('nested.html')

show(nested_layout)

This results in a plot as illustrated here:

Plots 1, 2, and 3 in a nested layout

In the previous code, we used the row function to combine Plot 1 and Plot 2 in a horizontal row and then used the column function on the horizontal...