THStack not filling histograms with color

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?

More information: I tried to wieght the histograms with weight=1, and it then plots them properly, with the plain color inside each histo. I also tried to do histo->Sumw2() but when I do this, it never draws the plain color, even if the weight is =1 or if there are no weights.

Thanks a lot for your help!

Can you provide a small script reproducing this problem ?

Here is a working script. The bool variable “weights” decides whether weights are applied or not on the histograms. You see immediately the difference on the plot.debug.C (5.9 KB)

Do:

  histo_stack->Draw("hist");

Explanation here.

It worked, thanks a lot!

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