Fill attribute is not fully reflected in THStack


ROOT Version: 6.22/06
Platform: macOS 10.15.7
Compiler: Clang


root [0] auto h1 = new TH1D("h1", "h1", 50, -5, 5)
root [1] auto h2 = new TH1D("h2", "h2", 50, -5, 5)
root [2] h1->FillRandom("gaus")
root [3] h2->FillRandom("gaus")
root [4] auto hstack = new THStack("hstack", "")
root [5] hstack->Add(h1)
root [6] hstack->Add(h2)
root [7] h1->SetFillStyle(0)
root [8] h2->SetFillStyle(0)
root [9] hstack->Draw("c")
root [10] gPad->SetGrid()

The above code draws correct h1 and h2 distributions, but the fill attribute 0 is not fully reflected in the canvas. If this is a bug, I will create a ticket. If not, would anyone tell me how to draw a transparent histogram?

Yes you can create a ticket (assigned to me). It is weird.

Done.

1 Like

Thank you.

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

Indeed this is expected … using the option “noclear” is the solution (see comment in the PR). THStack documentation has been clarified.