Problem drawing scaled histograms into THStack

Hello,

I am adding three histograms into a stack and writing the stack to a file. This is working fine, as long as I do not scale the histograms:

As soon as I scale the histograms beforehand and add them to the stack, the drawing style seems to change and the histograms are drawn in black lines only. I tried to change the drawing options of the histograms in final resulting stack, but it is not possible to change the colors or style after the stack has been written to file (e.g. using draw panel):

Obviously a not colored stack makes not much sense, therefore, could you please help me?

Here is the part of the code, that creates the stack (please let me know in case you need further information):

THStack* stack = new THStack("stack", "stack");
 
 // when I uncomment the following lines, the behaviour is as described above
 // h1->Scale(1 / nEvents);
 // h2->Scale(1 / nEvents);
 // h3->Scale(1 / nEvents);

h1->SetFillColor(kRed);
h2->SetFillColor(kGreen);
h3->SetFillColor(kBlue);
stack->Add(h1);
stack->Add(h2);
stack->Add(h3);
stack->Write();
h1->Write();
h2->Write();
h3->Write();

Cheers,
Julia


ROOT Version: 6.12/04
Platform: linux slc6
Compiler: gcc 6.2.0


Can you try to draw your stack with the option “HIST” ?

Hi,

thanks for your answer, this is working.

Cheers,
Julia

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