Hi there,
I have a PyROOT script and within it there seems to be a problem with changing canvas.
I’ve written a plain-English version of the script below… if there is no obvious/trivial problem with what I’m doing I could supply the exact code.
#instantiate 2 canvases
def plottingFunc(…pass in the 2 canvases, pass in a histogram…)
cd to canvas 1
draw a histogram on it
cd to canvas 2
make a ProfileX plot of the histogram above
plot this TProfile on canvas 2
print “Script has run to here”
#call the function above
plottingFunc(canv1,canv2,histo)
What happens when I run this script (in interactive mode) is this (the problem is at step 3):
- Canvas 1 is drawn and the histogram is put on it
- The script runs to the end (“Script has run to here” is printed)
- Canvas 2 REMAINS BLANK
- If I then interactively issue the command canvas2.cd(), the TProfile is then plotted on it. NB canvas2 is still in scope at this point
So, I can get my histogram and profile plot onto the 2 canvases, but I would prefer not to have to manually change to the 2nd canvas. Also, I would ideally like to plot something on a 3rd canvas, but this method of manually changing to the canvas does not seem to work when there are 3 of them.
Many thanks in advance for any help!
Sarah