Slide 1

Slide 1 text

PyCon Nove - Florence 19th - 22nd April 2018 BOKEH: USING PYTHON FOR INTERACTIVE DATA VISUALISATION Ernesto Arbitrio @__pamaron__ github.com/ernestoarbitrio PyCon Italia Apr 21, 2018

Slide 2

Slide 2 text

Agenda •What is Bokeh •Why Bokeh? •Basic Viz •ColumnDataSource •Js callbacks, widgets and toolYps •Embedding charts •Mapping Geo Data •Bokeh server •AddiYonal Features

Slide 3

Slide 3 text

What is Bokeh? [1] h4ps:/ /en.wikipedia.org/wiki/Bokeh Bokeh is the aesthe;c quality of the blur produced in the out-of-focus parts of an image produced by a lens. [1]

Slide 4

Slide 4 text

What is Bokeh? “allows users the flexibility to focus on the most important data without losing track of the rich context that allows it to be understood” - bokeh.pydata.org [1] h4ps:/ /en.wikipedia.org/wiki/Bokeh Bokeh is the aesthe;c quality of the blur produced in the out-of-focus parts of an image produced by a lens. [1]

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

so Bokeh is …. • is a data viz library • not unlike matplotlib, ggplot2 or d3.js • built also for the web • has strong ;es to data science and integra;on

Slide 7

Slide 7 text

Bokeh is …. To offer both simplicity and the powerful and flexible features needed for advanced customiza;ons, Bokeh exposes two interface levels to users: bokeh.models A low-level interface that provides the most flexibility to applica;on developers. bokeh.plo\ng A higher-level interface centered around composing visual glyphs.

Slide 8

Slide 8 text

Why Bokeh? Available in Python, R, …

Slide 9

Slide 9 text

Why Bokeh? Works with small to medium sized data

Slide 10

Slide 10 text

Why Bokeh? Real ;me two way server side interac;on

Slide 11

Slide 11 text

Why Bokeh? Real ;me two way server side interac;on

Slide 12

Slide 12 text

Bokeh Demo Part 1 notebooks/Part1-BasicViz.ipynb

Slide 13

Slide 13 text

ColumnDataSource ColumnDataSource is the object where the data of a Bokeh graph is stored. You can feed your graph directly with Python dic;onaries, pandas dataframes, etc, but for certain features such as having a popup window showing data informa;on when the user hovers the mouse on glyphs, you are forced to use a ColumnDataSource. Other uses would be when streaming data.

Slide 14

Slide 14 text

JS Callbacks, widgets and Tool;ps Bokeh provides different ways for users to supply custom JavaScript when necessary, so that users may add custom or specialized behaviours in response to property changes and other events.

Slide 15

Slide 15 text

Bokeh Demo Part 2 notebooks/Part2-JsCbaks-HoverTool.ipynb

Slide 16

Slide 16 text

Bokeh: Embedding Charts Bokeh provides a variety of ways to embed plots and data into HTML documents. Html files Components

Slide 17

Slide 17 text

Bokeh Demo Part 3 notebooks/Part3-Components-and-embed.ipynb

Slide 18

Slide 18 text

Bokeh + Web

Slide 19

Slide 19 text

Bokeh + Web

Slide 20

Slide 20 text

Mapping Geo Data Bokeh has started adding support for working with Geographical data. - Over mercator projection - Over google maps

Slide 21

Slide 21 text

Bokeh Demo Part 4 notebooks/Part4-GeoData.ipynb

Slide 22

Slide 22 text

Bokeh Server The Bokeh server is an op;onal component that can be used for sharing and publishing Bokeh plots and apps, for handling streaming of large data sets, or for enabling sophis;cated user interac;ons based off of widgets and selec;ons.

Slide 23

Slide 23 text

Bokeh Server

Slide 24

Slide 24 text

Bokeh Demo Part 5 Bokeh server

Slide 25

Slide 25 text

So … how does bokeh works? • Dynamic plo\ng engine • Consumes JSON to produce visualizaYons • Can use websockets get/send updates

Slide 26

Slide 26 text

So … how does bokeh works? BokehJS is not actually JS • Wri4en primarily in CoffeeScript • Bokeh Roadmap lists migra;on to TypeScript as a core improvement

Slide 27

Slide 27 text

AddiYonal Features

Slide 28

Slide 28 text

Integra;on with DataShader http://datashader.org/

Slide 29

Slide 29 text

Integra;on with dask

Slide 30

Slide 30 text

Integra;on with dask

Slide 31

Slide 31 text

Integra;on with HoloViews

Slide 32

Slide 32 text

Integra;on with HoloViews

Slide 33

Slide 33 text

Thanks Ernesto Arbitrio @__pamaron__ h`ps:/ /github.com/ernestoarbitrio/pycon9-bokeh-notebooks