Draw multiple canvas seperately in Jupyter notebook with pyROOT

Dear experts,

I am looking for a way to draw multiple canvas in Jupyter notebook with pyROOT.

So what I am trying to do is as the following:

for hist in hist_list:
    c = TCanvas("","",1200,900)

and what I am expecting is that multiple different plots for the histograms will be shown. However, what I got is only the last histogram in “hist_list”, and I am guessing it is because the later canvas overrode the earlier ones.

Is there a good way to plot them separately?

Thanks a lot!

Best regards,

With that code you would get several canvases with the normal ROOT.
I am not sure about Jupyter notebook.
May be @etejedor knows.

It might be because the canvases are garbage collected when you rebind c to a new TCanvas, and just the last one survives. I would try storing the canvases in a Python list.

Hi @etejedor ,

Yes indeed, now it works! Thanks!

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