Range of TGraph2D

From: OKUMURA, Akira <oxon_at_icrr.u-tokyo.ac.jp>
Date: Wed, 25 May 2005 15:29:20 +0900


Hello ROOTers,

(ROOT 4.00.08 on RH 7.3)

I would like to change the range of axes of TGraph2D. In other words, I would like to zoom out the TGraph2D. (NOT zoom in) TGraph2D->GetXaxis()->SetRangeUser() is not suitable to this porpose, because it automatically corrects overflows and underflows.

Then I tried using a dummy TH2D frame and "same" option as follows. 'dt' is drawn on the same pad, but axes ranges are NOT x[-250, 50] y[-150,150].
(Only labels are correct.)

How can I do ?

void test()
{

   TCanvas *C = new TCanvas;
   TGraph2D *dt = new TGraph2D;

   Double_t x,y,z;
   Int_t i, np = 0;

   ifstream fin;
   fin.open("out.dat");
   while (!fin.eof()) {

     fin >> i >> x >> y >> z;
     if (!fin.eof()) {
       dt->SetPoint(np, x, y, z+15);
       np++;
     } // if

   } // while
   fin.close();

   TH2D* frame = new TH2D("frame", "", 1, -250, 50, 1, -150,150);

   frame->SetMaximum(15.);
   frame->SetMinimum(-5.);
   frame->SetStats(kFALSE);
   frame->Draw("surf");

   dt->SetMaximum(15.);

   dt->SetMinimum(-5.);
   dt->Draw("surf4 same");

   return;
}

OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
Institute for Cosmic Ray Research, University of Tokyo 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan Tel/Fax : +81 4-7136-3153
Skype : okumura.akira Received on Wed May 25 2005 - 08:43:47 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:08 MET