Created
August 31, 2018 18:14
-
-
Save ericmjl/5fd39a3767f2e21bc45b18c031dc65e2 to your computer and use it in GitHub Desktop.
Holoviews dynamic map with datashader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datashader as ds | |
import holoviews as hv | |
from holoviews.operation.datashader import datashade | |
hv.extension('bokeh') | |
def scatter(dim1, dim2): | |
def _scatter(data): | |
return hv.Scatter(data, kdims=[dim1], vdims=[dim2], extents=(-10, -10, 10, 10)) | |
return _scatter | |
pipe = hv.streams.Pipe() | |
dmap = hv.DynamicMap(scatter('x', 'y'), streams=[pipe]) | |
datashade(dmap) | |
import numpy as np | |
n = 100000 | |
for i in np.arange(-np.pi, np.pi, 0.1): | |
x = np.random.normal(loc=0, scale=1, size=n) | |
y = i * x + np.random.normal(loc=0, scale=1, size=n) | |
pipe.send({'x': x, 'y': y}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment