{ auto c20=new TCanvas("c20","c20",600,400); int NBins = 50; double d = 2; auto hsc = new TH2F("hsc", "Surface and contour with option SAME ", NBins, -d, d, NBins, -d, d); for (int bx = 1; bx <= NBins; ++bx) { for (int by = 1; by <= NBins; ++by) { double x = hsc->GetXaxis()->GetBinCenter(bx); double y = hsc->GetYaxis()->GetBinCenter(by); hsc->SetBinContent(bx, by, exp(-x*x)*exp(-y*y)); } } hsc->Draw("surf2"); hsc->Draw("CONT1 SAME"); }