Unless I’m much mistaken that’s not the same thing. That returns the maximum and minumum values of the histogram, does it not? What I was asking about was the extreme values of the y axis, which in general are not equal to the histogram extrema.

On closer examination I see I’d misunderstood Couet’s macro. Yet it seems to make the problem worse rather than better – there seem to be inconsistencies in ROOT.

If I run the macro I get 28513.5 62738 which indeed seems to correspond to the limits of the Y axis. But that’s the first inconsistency: Why does ffoo->GetHistogram()->GetMinimum() return 28513.5 – the minimum of the function minus a margin – while ffoo->GetHistogram()->GetMaximum() return 59750.5 – the maximum of the function without a margin?

In other words, on an unzoomed function plot, GetMinimum() gives the correct lower limit of the y axis but GetMaximum() does not give the correct upper limit, and needs to have the margin added.

But if I use the mouse to zoom to about y = 35000 to 50000 and do ffoo->GetHistogram()->GetMinimum() and ffoo->GetHistogram()->GetMaximum() I get 35011 and 55076 – this time both GetMinimum() and GetMaximum() return the correct lower and upper limits, and if you add the margin to GetMaximum() you get the wrong value. This is a second inconsistency.