Hello,
this is probably a classical request, by I couldn’t find a working solution.
I have a pretty standard TH1, that I need to draw in logy (logarithmic Y axis). I do no set any user range, maximum, minimu, just fill it and then draw it. There are no bins with 0. I draw it and everything looks good.
Now, I need to know which is the displayed Y axis range. I mean which is the minimum of the Y axis that ROOT has used to draw.
If I try: hist->GetYaxis()->GetXmin() it returns 0. Even if when displayed in the log Y scale one can see the minimum is around 0.001 (10^-3).
As it contains a p-Value I want to know from the Y axis range till wich n x sigma lines I can show (1 sigma, 2 sigma,…) in a automatic way. canPV.pdf (13.4 KB)
but it seems that they don’t work well for log scale.
Alternatively, you can do the opposite of what you mention, i.e. set the maximum and minimum (h->SetMaximum(somevalue); ...) by knowing how much your sigmas would add to/subtract from the highest/lowest values in the histogram (h->GetMaximum(); ...).
In linear Y scale, gPad->GetFrame()->GetY1() returns exactly the expected value. For the log Y scale, it returns the log10 of the expected value. I mean if the Y axis starts at 0.0001, gPad->GetFrame()->GetY1() returns -4, which I can use for my calculations. Perfect