I plotted one TH1D histogram and one THStack histogram in one pad. I draw THStack first but got an error: attempt to access a null-pointer for
GetYaxis() works for TH1D but not for THStack Object. Does anyone know why and how to fix it?
In addition, the bottom part of histograms is cut off. I saw an old topic suggested to use gStyle->SetHistMinimumZero(kTRUE). How to write it in python? I tried SetMinimum(0) but it is not working. Actually the cut off just appeared when I shortened the variable range, for some unknown reasons.
Sorry for your confusion! Stack_hist is just total_mc, only different for name. I tried total_mc.Update() after drawing, but the running was interrupted by the error of null-pointer about GetYaxis(), the line before drawing.
I used total_mc = ROOT.gPad.Update() after drawing and got an error for SetTitle:
AttributeError: ‘NoneType’ object has no attribute ‘SetTitle’
It is interesting that Update() convert ‘THStack’ into ‘NoneType’. Why is that?
For larger Y value, let’s say (0.5, 1), so top 50% canvas is for Pad1. The Y axis is compressed but the histogram is still incomplete. I also tried smaller Y vaule (0.2, 1) to let Pad2 hide the bottom part of Pad1. In this case, the X axis scale is gone, so that means overlap. In the plot of my first message, the X axis scale survives. Thus I don’t think bottom cut off should be attributed to pads overlap.