Re: [ROOT] How to get x- and y-range of displayed histogram

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jun 01 2004 - 18:11:09 MEST


Thomas,

My guess is that you want to know the current frame coordinates.
Here is an example

Rene Brun

{
   TCanvas c1;
   TH1F h("", "", 10, 0, 1);
   h.Fill(0.5);
   h.Draw();
   c1.Update();
   //draw a line from the bottom right of the pad to the top left
   TLine line(c1.GetUxmax(),c1.GetUymin(),c1.GetUxmin(),c1.GetUymax());
   line.Draw();
}


Thomas Bretz wrote:
> 
> Dear all,
> 
> I display a histogram, eg
> TH1F h("", "", 10, 0, 1);
> h.Fill(0.5);
> h.Draw();
> 
> The displayed range in x I get calling:
> h.GetXaxis()->GetXmin();
> h.GetXaxis()->GetXmax();
> 
> Doing the  same for the y-axis fails. How do I get this range? (The aim
> is to draw a line from through the histogram)
> 
> Thanks in advance,
> Thomas.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET