Hi, Here a piece of code which reproduce exactly le problem I have on secondary axis labels : { TCanvas *c2 = new TCanvas("c2",""); hpx = new TH2F("hpx","toto",10,0,10,10,0,1); hpx->SetStats(kFALSE); hpx->Draw(); c2->Update(); TF1 *magax0 = new TF1("magax0","0.62*x",0,gPad->GetUxmax()*0.62); TGaxis *axe0 = new TGaxis(gPad->GetUxmin(), gPad->GetUymax(), gPad->GetUxmax(), gPad->GetUymax(),"magax0" ,510,"-"); axe0->Draw(); } Labels are not in front of major ticks... Guillaume Blanc On Sat, 5 Oct 2002, Rene Brun wrote: > 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:13 MET