Re: [ROOT] Secondary axis labels

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Oct 05 2002 - 10:55:54 MEST


Hi Guillaume,

Please send me a running script reproducing the problem.
With the simple test below, I cannot reproduce it:

{
  TCanvas *c1 = new TCanvas();
  TF1 *magax = new TF1("magax","0.62*x",0,gPad->GetUxmax()*0.62);
  magax->Draw();
  c1->Update();
  TGaxis *axe = new TGaxis(gPad->GetUxmin(), gPad->GetUymax(),
                           gPad->GetUxmax(),
                           gPad->GetUymax(), "magax" ,510,"-");
  axe->Draw();
}

Rene Brun


On Fri, 4 Oct 2002, Guillaume Blanc wrote:

> Hello,
> 
> When I plot a secondary X axis on a histogram, using a TF1 formula to get
> the ticks positions; it's works quite well, but for the labels, which are
> not in front of the major ticks, but between, with a lot of training
> decimals.
> 
> Here is the piece of code I use:
> 
>   // X axis is linear from 0 to 11.
>   c1->Update();
>   TF1 *magax = new TF1("magax","0.62*x",0,gPad->GetUxmax()*0.62);
>   TGaxis *axe = new TGaxis(gPad->GetUxmin(), gPad->GetUymax(),
>                            gPad->GetUxmax(),
>                            gPad->GetUymax(), "magax" ,510,"-");
>   axe->Draw();
> 
> The result of this is ticks well positionned, but labels are:
> 
> 0 - 1.1367 - 2.2733 - 3.41 - 4.5467 - 5.6833 - 6.82
> 
> The last number, 6.82 correponds to gPad->GetUxmax()*0.62.
> 
> Instead of what I would espect: 0 - 1 - 2 - 3 - 4 - 5 - 6
> 
> Is there a way to ask to TGaxis to put labels on major ticks and not
> between them ?
> 
> Thanks for your help.
> 
>               Guillaume Blanc
> 



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