Re: [ROOT] Axes question...

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed May 31 2000 - 18:24:36 MEST


Hi Claire,
You can set all these parameters either
 - interactively with the mouse by pointing on the axis and choosing
   the item SetNdivisions.
 - or samething in C++
 - or via TStyle

Examples of Axis options are given in the class TGaxis at URL:

http://root.cern.ch/root/html/TGaxis.html
in particular, see:
http://root.cern.ch/root/html/TGaxis.html#TGaxis:PaintAxis

The number of divisions is:
       ndiv=N1 + 100*N2 + 10000*N3
       N1=number of 1st divisions.
       N2=number of 2nd divisions.
       N3=number of 3rd divisions.

A positive value for ndiv indicates a target value around which to optimize
depending on teh axis values and teh plot range.
A negative value forces Root a particular number of divisions.

The example below shows how to solve your specific question.

{
   gStyle->SetLabelFont(12,"x");
   gStyle->SetLabelFont(72,"y");
   TH1F h("h","title",100,-2,2);
   h.SetMaximum(1);
   h.SetMinimum(0.5);
   h.GetYaxis()->SetNdivisions(505);
   h.Draw();
}   


Rene Brun

Claire Gwenlan wrote:
> 
> Hello,
> 
> I'm trying to make my histograms look all pretty and, more importantly,
> reproduce a particularly look that was in a published paper.
> 
> When I plot my histograms, the axes are labelled automatically with
> numbers. For, example, I have a certain distribution ranging from 0.5 to
> 1.0 and root automatically labels the axis as,
> 
> 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1.0
> 
> Is there any way that I can specify that only some numbers are drawn so
> that I have, for example,
> 
> 0.5  0.6  0.7  0.8  0.9  1.0
> 
> Also, I know there are several different font styles and things in TText
> and TLatex but can I change the font style on the axis numbers. For
> example, can I turn off the 'bold'?
> 
> Thanks a lot,
> 
> Claire
> 
> __________________________________
>  Claire Gwenlan
>  Department of Physics & Astronomy
>  University College London
>  Gower Street
>  LONDON
>  WC1E 6BT
> 
>  Tel: (0171) 419 3454
> _________________________________



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET