{ 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 c->SetTheta(-90); c->SetPhi(-89.99); 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 dt->GetZaxis()->SetNdivisions(2); //draw text at each point Double_t xyz[3], uv[2]; Int_t np = dt->GetN(); c->Update(); //TView *view = c->GetView(); //Double_t longit = view->GetLongitude(); //Double_t lat = view->GetLatitude(); //Double_t psi = view->GetPsi(); //cout << "Longit: " << longit << " Lat: " << lat << " Psi: " << psi <SetView(longit,view->GetLatitude(),view->GetPsi(),0); //view->SetView(10,0,100,irep); //c->Modified(); //c->Update(); // TText t; // t->SetTextSize(0.035); // for (Int_t i=0;iGetX()[i]; // xyz[1] = dt->GetY()[i]; // xyz[2] = dt->GetZ()[i]; // view->WCtoNDC(xyz,uv); // t->DrawText(uv[0]+0.01,uv[1],Form("point %d",i)); // } return c; }