Color of Histogram


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi,
I’m using theses commends to switch x and y axes but the histogram is shown only in black color.

hnew->SetFillColor(kBlue);
hnew->SetFillStyle(0);
hnew->Draw(“HBAR”);

Please help me.
Thanks in advance.

Example:

{
   h1 = new TH1F("h1","h1",10,-3,3);
   h1->FillRandom("gaus",10000);
   h1->SetBarWidth(0.5);
   h1->SetBarOffset(0.);
   h1->SetFillColor(kRed);
   h1->Draw("hbar2");

   h2 = new TH1F("h2","h2",10,-3,3);
   h2->FillRandom("gaus",10000);
   h2->SetBarWidth(0.5);
   h2->SetBarOffset(0.5);
   h2->SetFillColor(kBlue);
   h2->Draw("hbar2 same");
}

1 Like

Thanks for your answer.
I don’t want a filled histogram. Could you help me about unfilled histogram with different color.

This is not possible with HBAR

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