Hi, I’m trying to draw a simple THStack using the new RDataFrame class. The problem is that I get the histograms drawn as points, while I would like to have them drawn as line and filled with colors.
c125_25 = ROOT.TCanvas("c1", "c1", 0, 0, 800, 600)
df_top = ROOT.RDataFrame("ttbar", "/mypath/bkgade.root")
df_singletop = ROOT.RDataFrame("Wt", "/mypath/bkgade.root")
hsingletop = df_singletop.Histo1D("BDT_DeltaM100","Weight")
htop = df_top.Histo1D("BDT_DeltaM100","Weight")
hsingletop.SetFillColor(kOrange-9)
htop.SetFillColor(kAzure+1)
hsingletop.GetXaxis().SetLimits(0.,1.)
htop.GetXaxis().SetLimits(0.,1.)
hs = ROOT.THStack("","")
hs.Add(hsingletop.GetPtr())
hs.Add(htop.GetPtr())
hs.Draw("F")
Hi @eballabe ,
welcome to the ROOT forum!
To be 100% sure I understand the problem: can you get the THStack drawn as you want if RDataFrame is not involved?
Cheers,
Enrico
Hi @eguiraud ,
I just solved the issue (nothing to do with RDataFrame). I just changed the last line:
hs.Draw("HIST")
as I read here:
Dear all,
I am encountering a very peculiar esthetic issue: I have 8 histograms stacked with a THStack and drawn, each filled with its own color:
histo1->SetLineColor(1);
histo1->SetFillColor(1);
…
I then stack them, and draw them and everything works fine. Then I realized I actually need to weight those histograms when filling them:
histo1->Fill(variable, weight1);
…
And now, with weighted histos, the stack only draws the histograms line and not the “interior”. How can I solve this?
Mo…
Thanks for the reply!
Eric
1 Like