On Tuesday, March 24, 2020 at 6:20:15 PM UTC-5, Thomas Passin wrote: It turns out that using Holoviews with the matplotlib back end, it is easy > to save a plot image and show it in a Leo Restructured Text (@rst) node. > Using the Bokeh backend, or using Bokeh itself, you can actually embed the > entire interactive plot, using the .. raw directive: > > @language rest > .. raw:: html > :file: lines.html >
This was a bit confusing for me at first. lines.html comes from Bokeh's getting started example <https://docs.bokeh.org/en/latest/docs/user_guide/quickstart.html#getting-started> . This is also shown in bokeh_in_md.png. So to make this work, do the following: 1. Copy the example to any Leo node. Add the @language and @md section as shown. 2. Open vr3 with the vr3 command. 3. Choose MD from the Default Kind dropdown. 4. Choose Reload. This executes the code, creates lines.html and shows the plot. Very cool. After that, a node containing just: @language rest .. raw:: html :file: lines.html will show you just the graph, without the code. It's super cool. I haven't yet figure out how to use holoviews. I copied the code shown, namely: import holoviews as hv import holviews.util hv.extension('matplotlib') xs = range(-10, 11) ys = [100-z**2 for z in xs] curve = hv.Curve((xs, ys)) plot = renderer.get_plot(curve).state hv.save(curve, 'curve.png') Now I'm stuck. Neither reload nor execute creates curve.png. What should I do? Edward -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/4128fe20-fbb0-409e-80cd-2f562468efbf%40googlegroups.com.
