while delivering high-performance interactivity over large data to thin clients.
Three elements of this description are noteworthy:
Large data sets
It is a “plotting problem” in itself to plot large data sets. Just imagine a scatter plot
with 1,000,000 points — in general, large parts of the information get lost; Bokeh
provides built-in help in this regard.
Latest web technologies
In general, JavaScript is the language of choice as of today when it comes to web
development and visualization; it underlies libraries such as D3 (Data-Driven
Documents) and also Bokeh.
High-performance interactivity
On the Web, people are used to real-time interactivity (think modern browser games),
which can become an issue when visualizing and interacting with large data sets;
Bokeh also provides built-in capabilities to reach this goal.
On a fundamental level, working with Bokeh is not that different from working with
matplotlib. However, the default output generally is not a standard window or, for
example, an IPython Notebook (which is also an option). It is a separate HTML file:
In [ 47 ]: import bokeh.plotting as bp
In [ 48 ]: bp.output_file(“../images/msft_1.html”, title=“Bokeh Example (Static)”)
# use: bp.output_notebook(“default”)
# for output within an IPython Notebook
In terms of plotting, Bokeh provides a wealth of different plotting styles that are
continuously enhanced. To start with the simplest one, consider the following code that
generates a line plot similar to our pandas/matplotlib benchmark plot. The result is
shown as Figure 14-2. Apart from the x and y coordinates, all other parameters are
optional:
In [ 49 ]: bp.line(
data[‘Date’],
# x coordinates
data[‘Close’],
# y coordinates
color=‘#0066cc’,
# set a color for the line
legend=‘MSFT’,
# attach a legend label
title=‘Historical Stock Quotes’,
# plot title
x_axis_type=‘datetime’,
# datetime information on x-axis
tools = ”
)
bp.show()
In the tradition of matplotlib, Bokeh also has a gallery showcasing different plot styles.