Re: TGaxis

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Oct 30 1997 - 12:06:24 MET


ROHLFS Reiner wrote:
> 
> Hi Rooters,
> 
> I want to draw an axis. But the tick marks should be on the left side and the
> labels should be on the right side.
> 
> Here is my test macro:
> {
>   gROOT->Reset();
> 
>    c1 = new TCanvas("c1","canvas",50,10,400,500);
>    c1->Range(0.0, 0.0, 2., 1.5);
> 
>    axis1 = new TGaxis(0.3, 0.2, 0.3 , 1.3, 5., 8., 510, "");
>    axis1->Draw();
> 
>    axis2 = new TGaxis(0.8, 0.2, 0.8 , 1.3, 5., 8., 510, "-");
>    axis2->Draw();
> 
>    axis3 = new TGaxis(1.3, 0.2, 1.3 , 1.3, 5., 8., 510, "=");
>    axis3->Draw();
> 
>    axis4 = new TGaxis(1.8, 0.2, 1.8 , 1.3, 5., 8., 510, "+");
>    axis4->Draw();
> }
> 
> But axis1, axis2 and axis3 look all the same. The tick marks are on the right
> side and the labels are on the left side.
> Only axis4, which should be like the default one, has the tick marks on the
> left side.
> 
> Is this a bug or do I miss something?

What you get is correct. The confusion comes from what we
call "positive side" of the axis in the documentation.

In case of an horizontal axis, positive side is on top of the axis.
For a vertical axis, it is on the LEFT side. This is like an horizontal
axis rotated by +90 degrees (anticlockwise).
If you rotate your y axis by -90 degrees, the positive side
is now the RIGHT side of the axis.
Assuming TGaxis(x1,y1,x2,y2,amin,amax),
a rotation of +90 degrees occurs with x1=x2 and y1<y2
a rotation of -90 degrees occurs with x1=x2 and y1>y2

In case of your axis4, to get the labels on the right side
of the axis, use the option "+L" instead of "+"

Rene Brun



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