Hi Thilo,
you can e.g. do:
TFile f("hsimple.root");
TCanvas * c = new TCanvas("cc", "cc");
hpx->Draw();
c->GetFrame()->GetX1();
c->GetFrame()->GetX2();
c->GetFrame()->GetY1();
c->GetFrame()->GetY2();
nb: the range of the yaxis is only defined after drawing
the histogram taking into account a margin at top
so:
hpx->GetMaximum()
gives not the same result as:
c->GetFrame()->GetY2();
Cheers
Otto
On Mon, 31 Mar 2003 t.pauly1@physics.ox.ac.uk wrote:
> Dear Root experts,
>
> I'd like to get the range of the y axis of a histogram h. I have tried:
>
> double ymax = h->GetYaxis()->GetXmax();
> double ymin = h->GetYaxis()->GetXmin();
>
> which gives me ymax = 1 and ymin = 0, which is not the range I see when I
> plot h.
>
> On the other hand if I do the same for the x axis, I get the range I want.
> Do you have an idea how to get those numbers? I am using version 3.05/00.
>
> Thanks a lot,
> Thilo
>
>
--
Otto Schaile Sektion Physik, LMU Muenchen
Phone: +49 89 289 14070 Am Coulombwall 1, D-85748 Garching, Germany
GSM: +49 160 1553598
FAX: +49 89 289 14072 EMail: Otto.Schaile@Physik.Uni-Muenchen.DE
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET