Shade area for TH1

Hello,I have a TH1 object and I want to shade part area. How can I do this?

Please read tips for efficient and successful posting and posting code

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

  TH1F *h = new TH1F("h", "h;X;Y", 100, -5., 5.);
  TH1 *hh = (TH1*)h->Clone();
  // hh->SetLineWidth(0);
  hh->GetXaxis()->SetRangeUser(1., 2.);
  hh->Draw("SAME HIST");
  h->Draw("SAME HIST");
  h->Draw("SAME AXIS"); // ... or ... gPad->RedrawAxis();

Yes, thanks, it will come in handy, but I also need the inner area to be shaded, and not filled with solid

Try, e.g.: hh->SetFillStyle(3003);
See: TAttFill → Fill Area style

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