TAxis::SetLimits()...

From: Volker Boerchers (boercher@physik.uni-bremen.de)
Date: Tue Nov 09 1999 - 13:28:32 MET


Hi,

by using the mouse on an axis of a histogram display I can change the
displayed range, but this is quite inaccurate. So how can this be done
exactly, e.g. on the command line?  As an example I use the ntuple
defined in the tutorials/hsimple.root file and make a 1D histogram of
`pz' using the browser.

1) X-axis
* My first guess was TAxis::SetLimits().
  htemp->GetXaxis()->SetLimits(0,15)
works but instead of only changing the width of the view on the
histogram this simply exchanges the ticklabels so that the result is
simply wrong! (Maybe this function should be excluded from the user
interface?)

* My next guess was SetRange(). The context menue of TAxis has an entry
for SetRange(). Used for the xaxis of a TF1 it restricts the display
to the selected bins, so this is nearly as good as what you can do
with the mouse. But apart from the fact, that SetRange() only accepts
integer arguments the dialog of SetRange does not suggest a useful
default (0-0 instead of 0-nbins), so its not easy to find out the
right value.

2) Y-axis
Since the TAxis methods doesn't work at all for the y-axis of a 1d
histogram one has to use htemp->SetMaximum() and SetMinimum() instead.


What I would like best is a pair of "orthogonal" functions: one that
changes the axis range (where the axis starts and where it ends) and
another that limits the histogram to a certain range, e.g.
 htemp->GetXaxis()->SetAxisRange(0,20)
 htemp->GetXaxis()->SetCut(0,14)
This should lead to a display of pz=0..20 with a line starting at pz=0
and ending at pz=14. (This could make sense for a log plot to cut off
the low statistic tail of the distribution.)

I could imagine this functionality is already there but I couldn't
find it in the documentation.

Best regards,
  Volker

my ROOT version is 2.23/08
::.::::.::::.::::.::::.::::.::::.::::.::::.::::.::::.::::.::::.::::.::
Volker B"orchers, Uni Bremen, NW1, Raum 03160, Tel. +49-421-218-4522
 mailto:boercher@physik.uni-bremen.de
 http://hix.physik.uni-bremen.de/~boercher



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET