RE: invert an axis

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Mon, 17 Mar 2008 10:13:15 +0100


Hello,

See the attached example.

Cheers, Olivier

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Roger Mason
Sent: Saturday, March 15, 2008 9:58 PM
To: roottalk_at_lxbuild091.cern.ch
Subject: [ROOT] invert an axis

Hello,

I'd like to reverse the y axis of a TGraph so the numbers increase downwards. Can this be done without making them negative? If not, is there a way to remove the minus signs from the tick labels?

If it makes a difference here is the code fragment that plots the graph:

(other parts of arrays z and y filled elsewhere)...   T0 = cg0->Eval(z[40]);
  cg0->SetParameters(T0,2.6E-8,3.35,17E-3,40);   for (Int_t i=40; i<200; i++) {
  z[i] = i;
  y[i] = cg0->Eval(z[i]);
  }

  TGraph *gcg = new TGraph(200,y,z);

  gcg->SetLineColor(4);
  gcg->SetLineWidth(3);
  //  gcg->SetLabel();
  gcg->GetXaxis()->SetTitle("Temperature");
  gcg->GetYaxis()->SetTitle("Depth");
  gcg->Draw("AL");

I'm using 5.18/00 on Gentoo Linux.

Thanks,
Roger

Received on Mon Mar 17 2008 - 10:13:22 CET

This archive was generated by hypermail 2.2.0 : Mon Mar 17 2008 - 23:50:01 CET