How to zoom a portion of a histogram and insert over the same histogram

Hi everyone!

I am new to this forum.

I want to zoom a portion of a histogram and to put it on the same histogram in order to see the low energy peaks. I don’t have any idea how to proceed. I am attaching the picture in which this job is done and i want to plot exactly the same way.

Thank you

{
   auto h = new TH1D("h","h",100,-4,4);
   h->FillRandom("gaus",2000);
   h->Draw();
   TPad *p = new TPad("p","p", 0.5,0.6,0.9,0.8);
   p->Draw();
   p->cd();
   TH1D *hc = (TH1D *)h->DrawCopy();
   hc->GetXaxis()->SetRangeUser(0.,3.);
}
1 Like

@couet
Thank you so much for your instant reply, I got the idea. It worked well.

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