How to change the color of the background of histogram?

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->GetXaxis()->SetRangeUser(0, 1);

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.

How do I set any color in this plot?

kRed+1 etc.

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