3
votes

I'm using Datashader to make crossplots of different parameters due to the quantity of data I'm working with. My idea is to enable some kind of interaction that allows the user to select directly from the plot, the outliers based on the data's tendency showed these ones. I wonder if Holoviews Selection1D stream is compatible with datashader.

This code simulates what I meant:

import numpy as np
import holoviews as hv
from holoviews import opts
from holoviews import streams
from holoviews.operation.datashader import datashade
hv.extension('bokeh')

# Tools to select data
opts.defaults(opts.Points(tools=['box_select', 'lasso_select']))

# Random points to plot
random_points = hv.Points(np.random.randn(1000))

# Holoviews
selection = streams.Selection1D(source=random_points)

# Selected points by Holoviews selection stream
selected_box = hv.DynamicMap(lambda index: random_points.iloc[index],
                             kdims=[], streams=[selection])

# Final Overlay
Overlay = (random_points * selected_box).opts(padding = 0.01)
Overlay

So far so good, whenever I call selection I get a matrix compounded by the index of the selected points. After Calling the Datashader plot with datashade(Overlay) , the interaction between random_points and selected_box breaks, therefore I'm not sure if this stream is compatible with datashader or if the way I use the stream is wrong!

This is what inspired my idea: http://holoviews.org/reference/apps/bokeh/selection_stream.html#bokeh-gallery-selection-stream

1
New releases will make this way, way easier, but for now you can follow the approach in examples.pyviz.org/glaciers/glaciers.html to select an area on any plot (datashaded or otherwise) and reflect that in other plots.James A. Bednar
Helpful example to see the possibilities. Now I know it's not necessary to extract the data from the plot... I could just do another plot using streams (dynamic map)lsdR94

1 Answers

0
votes

Helpful example to see the possibilities. Now I know it's not necessary to extract the data from the plot... I could just do another plot using Dynamic maps and streams, either by bounds or selection1D.