Viewrendered3 How-To -- Insert An Interactive Plot Using Holoview and Bokeh

28 views
Skip to first unread message

Thomas Passin

unread,
Oct 15, 2020, 6:20:10 PM10/15/20
to leo-editor
An interactive plot can be inserted into the VR3 rendering pane.  This example uses Holoview and Bokeh.  Copy the following code into a node, open VR3, and execute it.  A screenshot is attached.

This can be done using Bokeh alone, but it's a little simpler using Holoview.  Matplotlib figures can also be inserted, but they will not be interactive.

@language python
# Following https://github.com/pyviz/holoviews/issues/1819
# for how to plot without using ipython/Jupyter

import holoviews as hv

hv.extension('bokeh')
xs = range(-10,11)
ys = [100-el**2 for el in xs]
curve = hv.Curve((xs,ys))

renderer = hv.renderer('bokeh')
renderer.save(curve,'curveh1')

@language rest
Here is the resulting (**interactive**) graph:

.. raw:: html
    :file: curveh1.html

vr3_interactive_plot.png

Edward K. Ream

unread,
Oct 16, 2020, 8:09:00 AM10/16/20
to leo-editor
On Thu, Oct 15, 2020 at 5:20 PM Thomas Passin <tbp1...@gmail.com> wrote:
An interactive plot can be inserted into the VR3 rendering pane.  This example uses Holoview and Bokeh.  Copy the following code into a node, open VR3, and execute it.  A screenshot is attached.

Thanks for this. This would be a good addition to VR3's docstring.

Edward

Offray Vladimir Luna Cárdenas

unread,
Oct 16, 2020, 2:13:25 PM10/16/20
to leo-e...@googlegroups.com

This is pretty cool! Interactive Live Coding Leo is closer and closer.

Cheers,

Offray

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/e27d5a0b-d8a7-4e11-a063-d6439f1ab37ao%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages