datashader, update plot in jupyter notebook with a ipywidgets controls ?

hello,

I've a database with lots of different data.

I made a Jupyter notebook with a number of ipywidgets to select the data I want to see / select / delete / etc.

For now I plotted the data with Timeseries in Bokeh.

But as the plots might become large (10 million or more points), drawing becames very slow (upto minutes).

(Another problem seems to be a memory leak, but that be my clumsy programming).

So now I moved to datashader for plotting, it seems to very fast, uses much less memory and doesn't show up a memory leak, GREAT.

But one thing I can't get working: how to update the datashader plot, after Ive made a different selection ?

The only way I get the datashader plot visisble is to put the definition in the last line of a jupyter cell, like

InteractiveImage ( p, DummyFunctie )

So for now I make a selection with some buttons, go to the celle where the datashader plot is definied and rerun that cell.

Any solution will be very welcome.

cheers,

Stef

InteractiveImage is very useful for quickly making an interactive
datashader plot, but it is always going to be very limited in its
functionality.

An easy way to do what you want is to replace your direct ipywidget calls
with the ParamNB <https://anaconda.org/jbednar/paramnb&gt; wrapper around
ipywidgets, which lets you re-run a subsequent notebook cell whenever one
of the parameters changes. I.e., if you want to, you can basically automate
the procedure you have now, which will force InteractiveImage to update
each time.

Alternatively, a cleaner and more powerful approach is to use HoloViews (a
library of high-level plotting objects from which InteractiveImage was
extracted) to instantiate a Datashader plot instead of InteractiveImage,
using HoloViews streams to connect ParamNB widgets for controlling it.
Here's an example (which you'll have to download before you can run it,
since it requires a live Python server):

https://anaconda.org/jbednar/nyc_taxi-paramnb

You'll need to adapt that to use hv.Curve instead of hv.Points, as in
Notebook :: Anaconda.org , but it
should be an clean and clear way to do what you are proposing. And then
you can deploy it using Jupyter Dashboards if you want.

The code for this is available as described in that notebook, but it has
not yet been full released (only in a dev release), and it is not clearly
documented yet. But it does do exactly what you're after, I think!

···

On Sat, Feb 18, 2017 at 3:53 AM, Stef Mientki <[email protected]> wrote:

I've a database with lots of different data.
I made a Jupyter notebook with a number of ipywidgets to select the data I
want to see / select / delete / etc.
For now I plotted the data with Timeseries in Bokeh.
But as the plots might become large (10 million or more points), drawing
becames very slow (upto minutes).
(Another problem seems to be a memory leak, but that be my clumsy
programming).
So now I moved to datashader for plotting, it seems to very fast, uses
much less memory and doesn't show up a memory leak, GREAT.
But one thing I can't get working: how to update the datashader plot,
after Ive made a different selection ?
The only way I get the datashader plot visisble is to put the definition
in the last line of a jupyter cell, like
InteractiveImage ( p, DummyFunctie )
So for now I make a selection with some buttons, go to the celle where the
datashader plot is definied and rerun that cell.
Any solution will be very welcome.

many thanks James,

ParamNB does the job.

HoloViews looks also very interesting, but I’ve to dive deeper into that. I did a few quick experiments timeseries with hv.Curve, but as my signals don’t have a sample on each timeaxis moment it doesn’t seem to be so simple.

cheers, Stef

···

On Saturday, February 18, 2017 at 10:53:09 AM UTC+1, Stef Mientki wrote:

hello,

I’ve a database with lots of different data.

I made a Jupyter notebook with a number of ipywidgets to select the data
I want to see / select / delete / etc.

For now I plotted the data with Timeseries in Bokeh.

But as the plots might become large (10 million or more points), drawing
becames very slow (upto minutes).

(Another problem seems to be a memory leak, but that be my clumsy
programming).

So now I moved to datashader for plotting, it seems to very fast, uses
much less memory and doesn’t show up a memory leak, GREAT.

But one thing I can’t get working: how to update the datashader plot,
after Ive made a different selection ?

The only way I get the datashader plot visisble is to put the definition
in the last line of a jupyter cell, like

InteractiveImage ( p, DummyFunctie )

So for now I make a selection with some buttons, go to the celle where
the datashader plot is definied and rerun that cell.

Any solution will be very welcome.

cheers,

Stef

many thanks James,

ParamNB does the job.

Great!

HoloViews looks also very interesting, but I've to dive deeper into that.
I did a few quick experiments timeseries with hv.Curve, but as my signals
don't have a sample on each timeaxis moment it doesn't seem to be so simple.

hv.Curve accepts arrays for x and for y, so it can plot arbitrary points;
there's no assumption of a regular sampling.

Jim

···

On Sun, Feb 19, 2017 at 5:14 PM, Stef Mientki <[email protected]> wrote: