Skip to content

Holoviews and Dask applications

Arman edited this page Jun 28, 2020 · 2 revisions

The combination of the Bokeh, DASK and Holoviews is allowing us to render interactively the large amount of the datasets. This example is deploying the an interactive visualization of the DASK dataframe with Holoviews application:

  1. create a file with server_app.py
import os
import dask.dataframe as dd
import holoviews as hv
from holoviews.operation.datashader import datashade

hv.extension('bokeh')

# 1. Load data and Datashade it
ddf = dd.read_parquet("~/sh_tmp.parq")[['xgal', 'ygal']].persist()
points = hv.Points(ddf, kdims=['xgal', 'ygal'])
shaded = datashade(points).opts(plot=dict(width=800, height=600))

# 2. Instead of Jupyter's automatic rich display, render the object as a bokeh document
doc = hv.renderer('bokeh').server_doc(shaded)
doc.title = 'HoloViews Bokeh App'
  1. in terminal start the Bokeh server:
bokeh serve --disable-index-redirect --allow-websocket-origin='*' --port 5006 server_app.py

3 now your interactive plot is accessible on following URL:

https://cocalc.com/PROJECT_ID/server/5006/server_app

Clone this wiki locally