TH1F fillColor not working

Hi all,

I read histograms from a file in a loop (actually 3 loops) and I want to give it a Fill color in order to use it in a stack after the loop. However, SetFillColor() doesn’t seem to affect the histo, the only thing that works is SetMarkerColor(). But I would like to use the fill to visualize the stack better.
You will find my code attached.
(Btw, I tried doing it seperately without the loop, and it works nicely :frowning: )

Best,
Des

reform_step2_stack.C (4.8 KB)

We cannot run your macro:

Error in <TFile::TFile>: file output2/intermediate_F_mJJ_v1.root does not exist

Can you post an example we can run reproducing the problem ?

1 Like

Sorry, I just included the input file, now it should work.

filling_issue.zip (77.7 KB)

    TCanvas *c1= new TCanvas();
    pt1->Draw("HIST");
    c1->Update();
    TCanvas *c2= new TCanvas();
    hnew->Draw("HIST");
    c2->Update();

Thanks couet, indeed now i see the fill in the histogram. Now regarding the stack, which is my goal, what should I do to see the Filled area there? I mean I would like to have the default plotting option that and also the filled area of the stack that I see in the first plot here:
https://root.cern.ch/doc/master/classTHStack.html
Right now, I add to the stack histograms that are already filled.

filling_issue.zip (77.7 KB)

Drawing the stack with option HIST or (may be netter) adding option HIST to individual histogram option when you add them to the stack should make it.

1 Like

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