Jsroot in jupyter's voila

Dear rooters,
I like very much using pyroot with histograms (displayed interactive by jsroot) in jupyter.

import ROOT
%jsroot on

Recently I have found a new stuff - “Voila”. Something that can convert jupyter notebook (using widgets) to a simple web application.

BUT

I cannot get the picture of the updated histogram.

I want to fill/display a histogram inside a callback function like def on_button_clicked(b)
if I do

with output:
    %matplotlib widget
    zs.speread( filename, hretu ,1 , tfrom, tto)
    his=zs.TH1_to_plt( hretu )
    fig,ax=plt.subplots(figsize=(12,8))
    ax.plot( *zip(*his))
    plt.show()

I get an interactive histogram (poor quality in comparison to JSROOT). When I try this:

with output:
    zs.speread( filename, hretu ,1 , tfrom, tto)
    canvas1=ROOT.TCanvas("cc","",800,800)
    canvas1.Draw()
    canvas1.cd(0)
    hretu.Draw("")
    canvas1.Draw()

I get a jsroot histogram in jupyter, BUT nothing in Voila

The following piece of code -outside the callback- displays JSROOT nicely, but hretu is not updated later on, after callback calls:

canvas2=ROOT.TCanvas("c11","",800,800)
hretu.Fill(1000)
hretu.Draw()
canvas2.Draw()

Does anybody have an experience how to get JSROOT into Voila game? Thank you, Jaromir

Hi,

ROOT Jupyter notebooks work following way - when you type canvas1.Draw(), plain JSON object is created and inserted into Jupyter web-page. JSROOT just parse and draw data from that JSON. There is no connection between canvas and previously done drawings. Any objects changes can be presented only in the new drawings.

We have a plans to implement more advanced features with JupyterLab, but it is only the plans and they will not happen before end of 2020.

Regards,
Sergey

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.