Re: Range of TGraph2D

From: Olivier Couet <couet_at_mail.cern.ch>
Date: Wed, 25 May 2005 09:57:55 +0200 (CEST)

 Hello,

 I think the best would be to use a function like SetHistogram. It is available in TGraph but not in TGraph2D. I will implement it. I let you know when it is ready.

 O.Couet

On Wed, 25 May 2005, OKUMURA, Akira wrote:

> 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
>
>

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7670300
Received on Wed May 25 2005 - 09:58:01 MEST

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