I want to change the color of one part of a histogram to highlight this part, like the red one. How should I do?
void highlighthist() {
auto h1 = new TH1F("h1", "h1", 100, -5., 5.) ; h1->FillRandom("gaus", 10000);
auto h2 = (TH1F*)h1->Clone();
h2->SetFillColor(kBlue-3);
h1->Draw();
h2->GetXaxis()->SetRangeUser(0, 1);
h2->Draw("SAME");
}
Thankyou! But I prefer to set the whole histogram of this part to another color like this picture
To obtain the last picture you sent, simply draw a TBox on top of your histogram.
kRed+1 etc.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.