Re: [ROOT] 2D graph ??

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Dec 21 2000 - 22:54:55 MET


Hi Ray,
I already answered a similar question this afternoon.
In your case, you can do something like:

// choose xmin,xmax,ymin,ymax at your convenience.
//here, I show xmin=0, xmax=nx, etc.
TH2F *h2 = new TH2F("h2","some title",nx,0,nx,ny,0,ny);
for (int i=0;i<nx;i++) {
   for (int j=0;j<ny;j++) {
      h2->Fill(x[i],y[i],z[i][j]);
   }
}
h2->Draw("surf"); //look at $ROOTSYS/tutorials/draw2dopt.C for examples


Rene Brun


On Thu, 21 Dec 2000, Ray Fliller III wrote:

> 
> 
>  Hello Rooters,
> 
>    Given 2 arrays X and Y and a 2D array Z where Z[i][j]=Z(X[i],Y[j]), 
> how do I make a graph of this??  There is no TGraph2D, perhaps this could 
> be an added class....
> 
>   Ray
> 
> ==============================================================================
> Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124 
> C-A Accelerator Physics     
> Building 911
> Brookhaven National Lab
> Upton, NY 11973                    Office: Room 211
> ==============================================================================
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:40 MET