Re: Putting markers on a TGraph2D

From: Roger Mason <rmason_at_esd.mun.ca>
Date: Sun, 17 May 2009 07:26:50 -0230


Hello Rene,

Rene Brun <Rene.Brun_at_cern.ch> writes:

> Simply do:...

Firstly, thank you for your help.

I now have a macro that does most of what I want:

// PlotHeights.C
{

   TCanvas *c = new TCanvas("c","Graph2D example",0,0,600,400);

   TGraph2D *dt = new TGraph2D("graph.dat");

   gStyle->SetPalette(1);

   Double_t contours[] = {20,40,60,80,100,120,140,160,180,200};

   // Set the canvas range a bit bigger than the x,y data ranges    c->Range(0,0,160,160); // does not work

   TH2D* h = new TH2D();

   h = dt->GetHistogram();      // Get histo interpolated between
                                // control points in dt.
   h->SetContour(10,contours);     // Set 10 contour levels (default is 20)
   h->Draw("surf2");            // Draw interpolated points as surface
   h->Draw("cont1 same");       // Contour the surface
   dt->SetMarkerStyle(8);       // Marker for the control points
   dt->Draw("p same");             // Superimpose the control points

   return c;
}
// ROOT 5.20/00 (trunk_at_24524, Sep 30 2008, 15:32:00 on linux)

I would like to set the viewpoint in 3D so that I can make a birds eye view of the contours (like a topographic map). I could not find mention of this in the documentation, but perhaps I'm looking in the wrong place. I would also like to be able to label the points plotted from dt with bin content (height).

Thanks again,
Roger Received on Sun May 17 2009 - 12:06:34 CEST

This archive was generated by hypermail 2.2.0 : Sun May 17 2009 - 17:50:01 CEST