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)

Linking multiple plots together

At times, we might want our plots to have the same range of values along the x-and/or y-axes in order to facilitate meaningful comparison of the same range of points across different plots.

We will be working with plot1, plot2, and plot3 as illustrated in the sections before this.

In order to create multiple plots with the same range along the y-axis, we use the code shown here:

#Import the required packages

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

#Creating equal y axis ranges

plot3.y_range = plot1.y_range

#Create the row layout

row_layout = row(plot3, plot1)

#Output the plot

output_file('grid.html')

show(row_layout)

This results in a layout of plots as illustrated here:

Plots 1 and 3 linked together by the same y axis range as plot 3

In the previous code, we gave plot1 the same y-range as plot3. In the resulting...