This is an old revision of the document!
The normal way to change the display range of an axis is:
histogram->GetYaxis()->SetRangeUser(lower,upper);
but there are several situations where this fails. See below for help in these cases.
Assume you have a histogram which has been normalized it with
hist->SetNormFactor(1)
Your Y-axis will show values between 0 and 1. Trying to set the Y range using these values, eg.
SetRangeUser(0.01, 0.2)
will fail however. You still need to give the range in the original unnormalized units.
You can scale normalized units back with:
Double_t scaleY = hist->GetEntries()/hist->GetNormFactor(); hist->GetYaxis()->SetRangeUser(normalizedLower*scaleY,normalizedUppe*scaleY);
If you have a TGraph, SetRangeUser will not work for the x axis. It will not complain but also not do anything. Or not the thing you want.
You have to use SetLimits(), like:
TGraph* myGraph = new TGraph(); ... myGraph->SetLimits(lower,upper);