Introducing the Bokeh Server Interactive Data Visualization with - - PowerPoint PPT Presentation

introducing the bokeh server interactive data
SMART_READER_LITE
LIVE PREVIEW

Introducing the Bokeh Server Interactive Data Visualization with - - PowerPoint PPT Presentation

INTERACTIVE DATA VISUALIZATION WITH BOKEH Introducing the Bokeh Server Interactive Data Visualization with Bokeh Interactive Data Visualization with Bokeh Interactive Data Visualization with Bokeh Basic App Outline outline.py from


slide-1
SLIDE 1

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Introducing the Bokeh Server

slide-2
SLIDE 2

Interactive Data Visualization with Bokeh

slide-3
SLIDE 3

Interactive Data Visualization with Bokeh

slide-4
SLIDE 4

Interactive Data Visualization with Bokeh

Basic App Outline

  • utline.py
  • from bokeh.io import curdoc

# Create plots and widgets # Add callbacks # Arrange plots and widgets in layouts curdoc().add_root(layout)

slide-5
SLIDE 5

Interactive Data Visualization with Bokeh

Running Bokeh Applications

Run single module apps at the shell or Windows command prompt: “Directory” style apps run similarly:

bokeh serve --show myapp.py bokeh serve --show myappdir/

slide-6
SLIDE 6

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Let’s practice!

slide-7
SLIDE 7

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Connecting Sliders to Plots

slide-8
SLIDE 8

Interactive Data Visualization with Bokeh

A slider example

slider.py

  • from bokeh.io import curdoc

from bokeh.layouts import column from bokeh.models import ColumnDataSource, Slider from bokeh.plotting import figure from numpy.random import random N = 300 source = ColumnDataSource(data={'x': random(N), 'y': random(N)}) # Create plots and widgets plot = figure() plot.circle(x= 'x', y='y', source=source) slider = Slider(start=100, end=1000, value=N, step=10, title='Number of points')

slide-9
SLIDE 9

Interactive Data Visualization with Bokeh

A slider example

# (continued) # Add callback to widgets def callback(attr, old, new): N = slider.value source.data={'x': random(N), 'y': random(N)} slider.on_change('value', callback) # Arrange plots and widgets in layouts layout = column(slider, plot) curdoc().add_root(layout) slider.py

slide-10
SLIDE 10

Interactive Data Visualization with Bokeh

slide-11
SLIDE 11

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Let’s practice!

slide-12
SLIDE 12

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Updating Plots from Dropdown Menus

slide-13
SLIDE 13

Interactive Data Visualization with Bokeh

A Select example

select.py

  • from bokeh.io import curdoc

from bokeh.layouts import column from bokeh.models import ColumnDataSource, Select from bokeh.plotting import figure from numpy.random import random, normal, lognormal N = 1000 source = ColumnDataSource(data={'x': random(N), 'y': random(N)}) # Create plots and widgets plot = figure() plot.circle(x='x', y='y', source=source) menu = Select(options=['uniform', 'normal', 'lognormal'], value='uniform', title='Distribution')

slide-14
SLIDE 14

Interactive Data Visualization with Bokeh

A Select example

select.py

  • # (continued)

# Add callback to widgets def callback(attr, old, new): if menu.value == 'uniform': f = random elif menu.value == 'normal': f = normal else: f = lognormal source.data={'x': f(size=N), 'y': f(size=N)} menu.on_change('value', callback) # Arrange plots and widgets in layouts layout = column(menu, plot) curdoc().add_root(layout)

slide-15
SLIDE 15

Interactive Data Visualization with Bokeh

A Select example

slide-16
SLIDE 16

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Let’s practice!

slide-17
SLIDE 17

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Buons

slide-18
SLIDE 18

Interactive Data Visualization with Bokeh

Buon callbacks

select.py

  • from bokeh.models import Button

button = Button(label='press me') def update(): # Do something interesting button.on_click(update)

slide-19
SLIDE 19

Interactive Data Visualization with Bokeh

Buon types

select.py

  • from bokeh.models import CheckboxGroup, RadioGroup, Toggle

toggle = Toggle(label='Some on/off', button_type='success') checkbox = CheckboxGroup(labels=['foo', 'bar', 'baz']) radio = RadioGroup(labels=['2000', '2010', '2020']) def callback(active): # Active tells which button is active

slide-20
SLIDE 20

Interactive Data Visualization with Bokeh

Buon types

Plain button Toggle Radio Group Checkbox Group

slide-21
SLIDE 21

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Let’s practice!

slide-22
SLIDE 22

INTERACTIVE DATA VISUALIZATION WITH BOKEH

Hosting Applications

slide-23
SLIDE 23

Interactive Data Visualization with Bokeh

Bokeh Application Hosting

https://anaconda.org