Putting markers on a TGraph2D

From: Roger Mason <rmason_at_esd.mun.ca>
Date: Sat, 16 May 2009 08:35:09 -0230


Hello,

I am trying to put markes at specific positions on a TGraph2D. Here is the macro:

{

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

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

   Int_t n = dt->GetN();
   Double_t* x = dt->GetX();
   Double_t* y = dt->GetY();

   TMarker* m = new TMarker();

   gStyle->SetPalette(1);
   dt->Draw("surf2");
   dt->Draw("CONT1 SAME");

   for (Int_t i = 0; i < n; i++ ){

     m = new TMarker(x[i],y[i],8);
     m->Draw("SAME");

   }

   return c;
}

graph.dat:

13 18 200
15 100 40
59 46 100
79 78 199
124 62 80
145 20 20
145 100 100

I have tried a few variations. The TGraph2D is drawn correctly but the markers are never visible. If someone can tell me how to draw a point at a position on the surface drawn by TGraph2D I'd be most grateful.

Thanks,
Roger

ROOT 5.20/00 (trunk_at_24524, Sep 30 2008, 15:32:00 on linux) Received on Sat May 16 2009 - 13:14:36 CEST

This archive was generated by hypermail 2.2.0 : Sat May 16 2009 - 23:50:01 CEST