Hi all,
I’m using pyROOT, and I can’t get any axis labels to appear on my THStack’s. I thought I remember hearing that the THStack would display the same axis labels that the first histogram added has, but that is not happening for me. For example:
c1 = TCanvas("default","default")
first = TH1F("first","first",10,0,10)
second = TH1F("second","second",10,0,10)
for i in range(100) :
if i < 33 :
first.Fill(i % 2)
second.Fill(i % 4)
elif i < 66 :
first.Fill(i % 5)
second.Fill(i % 7)
else :
first.Fill(i % 8)
second.Fill(i % 10)
stack = THStack("stack","stack")
stack.Add(first)
stack.Add(second)
first.GetXaxis().SetTitle("counts")
second.GetXaxis().SetTitle("counts")
second.SetLineColor(kRed)
stack.Draw()
c1.Print("stack.png")
The result does not have any label on the x axis. I’m using ROOT v5.16/00, so maybe this is solved in newer versions? Thanks for any help.