scikit-hep/root_numpy

Import of root_numpy somehow uses a canvas?

jonas-eschle opened this issue · 3 comments

Hi there,

I just came across some strange behavior, which I think is not intended.

A simple plot (or only canvas drawing) in python:

from ROOT import RooRealVar
from ROOT import TCanvas <- this "solves" the problem
import root_numpy <- this produces the "bug"
x = RooRealVar("x", "x variable", 5000, 6000)
xframe = x.frame()
xframe.Draw()

It works and the canvas shows up if we omit the second and third line.
Using also the root_numpy import-statement will result in no drawing but two warnings instead and no canvas will be shows:

TCanvas::ResizePad:0: RuntimeWarning: c1 width changed from 0 to 10
TCanvas::ResizePad:0: RuntimeWarning: c1 height changed from 0 to 10

First importing TCanvas too before importing root_numpy resolves the problem.
I am not sure how this is caused and whether it is a problem, but it's a strange behavior.
What do you think?

My specs:

  • Python 2.7
  • root-numpy 4.5.2
  • ROOT 5.34/30 (the Ubuntu-repository version with bindings)
  • Ubuntu 16.04
ndawe commented

root_numpy doesn't use TCanvas anywhere. I'm not sure what the problem is. I see the canvas pop up with and without the root_numpy import.

ndawe commented

Although I'm using ROOT 6.06.02. Could be some obscure problem with 5.34.30

Ok, thanks for you investigation! As it seems not to occur on later versions and as there is a "hack" available, I close this issue.