Re: [ROOT] Problems with SetNDivisions

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Wed Jul 10 2002 - 16:09:41 MEST


Hi,

 By default the number of axis divisions is optimised when the axis is
drawn. So when you do SetNdivisions(404), the number of primary and
secondary divisions will be maximum 4. If you want to have exactly 4
primary and secondary divisions you should give -404 in that case the
number of divisions will not be optimise even if the result looks ugly.
This mechanism is valid for axis automatically produced when you plot an
histogram or a graph.

 If you draw an axis directly the rules are a bit different. If you want
to switch off the divisions optimisation you should NOT give a negative
divisions number (as in SetNDivisions) but you must give the option "N".
Example: 

TGaxis *axisR = new TGaxis(3600,0,3600,8000,0,1600,505,"+N");

You can find this option in the TGaxis help page.

Cheers,          Olivier Couet


Steffen Grohmann wrote:
> 

> 
> Hello,
> 
> I have problems to format axes using SetNdivisions. In the example below
the
> intension is to create a y-axis with 4 primary and 4 secondary
divisions. If
> I use SetNdivisions(404), the program doesn't follow the request but I
can
> at least force it with (-404). This, however, does not work on an axis
drawn
> with TGaxis, e.g. to draw another y-axis on the right of the graph.
There I
> cannot use the minus.
> 
> Scaling the right axis from 0 to 800, ndiv=404 leads to 1 first and 1
> secondary division. By trial and error I fond that ndiv=505 works.
However,
> scaling the same axis from 0 to 1600, neither ndiv 404 nor 505 nor
anything
> else seems to help.
> 
> Is there some way to generally switch off the optim function for
dividing
> axis? I have the impression that the operation of the command is somehow
> contradicting to what is written in the manual.
> 
> Best regards,
> Steffen

--
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                                    
E-Mail: Olivier.Couet@cern.ch                      Phone: +41 22 7674886
WWW:    http://cern.ch/Olivier.Couet/              Fax:   +41 22 7677155



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET