[ROOT] Re: Full controle over axis

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Feb 17 2003 - 09:14:15 MET


Hi Christian,

I assume that you are making an histogram from a Tree.
By default, the computation of the limits is automatic.
See page 270,271 of the Users Guide for a manual control
of the binning.
  T.Draw("x"); // automatic binning
  T.Draw("x>>hx(60); //automatic binning forcing 60 bins instead of 100
  T.Draw("x>>hx(50,0,1000); force user binning
  etc

Rene Brun

Christian Hansen wrote:
> 
> Dear Rooters,
> 
> I wonder how it is possible to decide the range of
> the x and y axis around a histogram.
> 
> For example if the highest bin in one histogram is
> 590 then the range of the y axis goes up to around
> 600 automatically. I wanted to change this to 1000 :
> 
>   Axis_t ymin = 0.0;
>   Axis_t ymax = 1000.0;
>   hist->GetYaxis()->SetRangeUser(ymin, ymax);
>   hist->Draw();
> 
> But nothing happened (not even an error message).
> So the y axis stayed as it was before. How can I
> get full controle of the view range of the axis
> of an histogram? I've also tried with SetLimits
> with the same result; nothing happened.
> 
> The reason why I want to controle the axis limits
> is because I want to show this histogram as a
> comparison with another histogram, and that will
> work better if the two histograms are plotted
> in axis with the same range.
> 
> Thank you
> --
> / Christian Hansen
> 
> ===============================================
> 161-01-016            Office: +41-(0)22-7677598
> CERN
> CH-1211 Geneve 23
> Switzerland
> -----------------------------------------------
> Mobile    : +41-(0)79-7742530
> Home Page : http://welcome.to/Christian_Hansen
>             http://cern.ch/Christian.Hansen



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET