Tick and label on the same side

Hi,

I am trying to get the tick marks and axis label printed on the same side. I thought chopt=’=’ did the trick but no luck!


{
   c1 = new TCanvas("c1","Examples of TGaxis",10,10,700,500);
   c1->Range(-10,-1,10,1);

   TGaxis *axis = new TGaxis(-8,-0.6,8,-0.6,-100000,150000,505,"-=");
   axis->SetLabelSize(0.03);
   axis->Draw();
}  

thanks as always
Erdos
Root 5.22/ 5.18

{
   c1 = new TCanvas("c1","Examples of TGaxis",10,10,700,500);
   c1->Range(-10,-1,10,1);

   TGaxis *axis = new TGaxis(-8,-0.6,8,-0.6,-100000,150000,505,"+-");
   axis->SetLabelSize(0.03);
   axis->Draw();
}

Hi Couet,

Thanks for your reply. However, the axis you suggested looks okay if its drawn at the bottom of the plot. OTOH, I wouldn’t put it at the top of the plot. Please see the attachment for what I was hoping to achieve. I ended up having to use lines. etc! :slight_smile:

I am still wondering when to use the ‘=’ option.

Cheers
Erdos

can you sen me a small macro showing what you do ?
the is other way to draw such ticks. Like gPad->SetTickx()
also the option X+ and Y+ like in the following example:

{
   TCanvas *c1 = new TCanvas("c1","c1",600,600);
   TPad *pad1 = new TPad("pad1","",0,0,1,1);
   TPad *pad2 = new TPad("pad2","",0,0,1,1);
   pad2->SetFillStyle(4000); //will be transparent
   pad2->SetFrameFillStyle(0);


   TH2F *h1 = new TH2F("h1","h1",40,-4,4,40,-4,4);
   TH2F *h2 = new TH2F("h2","h2",40,-40,40,40,-40,40);
   Double_t a,b;
   for (Int_t i=0;i<5000;i++) {
      gRandom->Rannor(a,b);
      h1->Fill(a-1.5,b-1.5);
      h2->Fill(10*a+1.5,10*b+1.5);
   }

   pad1->Draw();
   pad1->cd();
   h1->Draw("");

   pad2->Draw();
   pad2->cd();
   h2->SetMarkerColor(kRed);
   h2->Draw("X+Y+");
}