Bokeh supports a variety of different types of usage, depending on one's needs. The Bokeh developers draw a distinction between "standalone" figures that are generated once and then viewed in a browser, and figures generated through the use of a Bokeh server that can be updated in response to user actions or changes in the data.

Standalone HTML pages with figures

Bokeh-generated HTML pages encode statically rendered figures that are able to leverage responsive aspects of the JavaScript that is embedded within those pages to support particular types of interactivity, completely supported within one's local browser. This includes being able to:

  • hover over plot elements to trigger the display of additional related information
  • link aspects of different plots with related data so that zooming and panning on one plots triggers corresponding changes on others
  • link the selection of data points in one plot to highlight those data samples in other plots
  • modify the data that are plotted, if one is willing to write JavaScript code to support that

Within Jupyter notebooks

The standalone interactive functionality embedded in webpages can also be generated within Jupyter notebooks, just as one would typically embed plots and figures alongside code and markdown documentation.

In order to have Bokeh plots rendered (interactively) within Jupyter notebooks, one only needs to modify where the output goes, using the following lines of code:

Some of the examples that we show on the following pages instead write the HTML output to a file (using the output_file function), which can be viewed in a separate browser window or embedded into the text of this tutorial. If you would like to run some of the subsequent code examples in a Jupyter notebook instead, you can modify the code to use the output_notebook function instead of output_file.

Servers with interactions and callbacks

Bokeh servers can be developed to support not just the types of interactivity described above, but also to modify what gets plotted based on user interactions and to guide new analyses of those data based upon interactivity and interactions. This additional functionality is accomplished primarily through the development of callback functions, written in Python, that modify plotted data in response to various user interface (UI) actions. The term "Bokeh server" refers to the particular mode in which a Python+Bokeh program is run, but that same server architecture can both support one's individual data analyses in a local browser (localhost) as well as serve interactive visualization and analysis platforms to large groups of users over the internet.

Dashboards and GUIs

A common use case for applications using the Bokeh server architecture is to create "data dashboards" that enable users to easily interrogate large and complex datasets through graphical user interfaces (GUIs). Many frameworks exist for creating such dashboards, each with their strengths and weaknesses. Bokeh is not an application, but an application programming interface (API), which — on the one hand — requires developers to create their own data visualizations from scratch, but which — on the other hand — unleashes the full power of the Python ecosystem for data science and scientific computing to those developers. Users of Bokeh are not constrained by the limits of predefined data processing functionality or ad hoc macro languages that enable them to automate certain processes, as might be the case for other frameworks.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement