11 Streaming Data

"Streaming data" is data that is continuously generated, often by some external source like a remote website, a measuring device, or a simulator. This kind of data is common for financial time series, web server logs, scientific applications, and many other situations. We have seen how to visualize any data output by a callable in the Live Data user guide and we have also seen how to use the HoloViews stream system to push events in the user guide sections Responding to Events and Custom Interactivity .

This user guide shows a third way of building an interactive plot, using DynamicMap and streams. Here, instead of pushing plot metadata (such as zoom ranges, user triggered events such as Tap and so on) to a DynamicMap callback, the underlying data in the visualized elements are updated directly using a HoloViews Stream .

In particular, we will show how the HoloViews Pipe and Buffer streams can be used to work with streaming data sources without having to fetch or generate the data from inside the DynamicMap callable. Apart from simply setting element data from outside a DynamicMap , we will also explore ways of working with streaming data coordinated by the optional separate streamz library from Matt Rocklin, which can make building complex streaming pipelines much simpler.

Note that this page demonstrates functionality that requires a live, running Python server. When exported to a static HTML page as on the pyviz.org website, you will only see a single plot. When running this code as a Jupyter notebook, you should execute it cell by cell to see the effect of each operation in turn.

In [1]:
import time
import numpy as np
import pandas as pd
import holoviews as hv

from holoviews.streams import Pipe, Buffer

import streamz
import streamz.dataframe