How do I programmatically create a sub histogram?

Dear rooters,

I’m a newbie to Root. Maybe my question sounds silly, but I do need urgent help.

Here is my problem:

I have a 1D histogram, and I set both x axis and y axis to Log. Later I find out that I only want to show part of the histogram, say, I want the x axis ( the log value) to be in range {10^(-3), 10^3), and discard the other parts of the histogram.

In GUI, I can use mouse to zoom the range I want.

But How can I do this in my script???

Thanks.

Use TAxis::SetRange or RangeUser. See:
root.cern.ch/root/htmldoc/TAxis. … s:SetRange
root.cern.ch/root/htmldoc/TAxis. … tRangeUser

eg,

myhist->GetXaxis()->SetRangeUser(1e-3,1e3);

Rene

It works! Great!

Thank you so much!, Rene!