void graph2d20() { TCanvas *c1 = new TCanvas("c1","Graph2D example",0,0,700,600); Double_t P = 5.; Int_t npx = 20 ; Int_t npy = 20 ; Double_t x = -P; Double_t y = -P; Double_t z; Int_t k = 0; Double_t dx = (2*P)/npx; Double_t dy = (2*P)/npy; TGraph2D *dt = new TGraph2D(npx*npy); dt->SetNpy(41); dt->SetNpx(40); for (Int_t i=0; iSetPoint(k,x,y,z); k++; y = y+dx; } x = x+dx; y = -P; } gStyle->SetOptStat(0); gStyle->SetPalette(kBlueRedYellow ); gStyle->SetNumberContours(90); dt->GetXaxis()->SetTitle("X title"); dt->GetYaxis()->SetTitle("Y title"); dt->GetXaxis()->SetLabelFont(42); dt->GetYaxis()->SetLabelFont(42); dt->GetZaxis()->SetLabelFont(42); dt->GetXaxis()->SetTitleFont(42); dt->GetYaxis()->SetTitleFont(42); dt->Draw("SURF1"); }