{ gROOT->Reset(); // Create a new canvas. TCanvas *c1 = new TCanvas("c1","ccc",100,100,700,500); hpxpy = new TH2F("hpxpy","py vs px",100,-4,4,100,-4,4); hpxpy2 = new TH2F("hpxpy2","py vs px",100,-4,4,100,-4,4); // Fill histograms randomly gRandom->SetSeed(); Float_t px, py, pz; Float_t px1, py1; for (Int_t i = 0; i < 25000; i++) { gRandom->Rannor(px,py); gRandom->Rannor(px1,py1); hpxpy->Fill(0.3 * px + 1, 0.7 * py+0.5); hpxpy->Fill(0.5 * px - 1, 0.5 * py-0.5); hpxpy2->Fill(px, px * 0.5 + 0.5 * py); } // boxes hpxpy->SetLineColor(kRed); hpxpy->Draw("box"); hpxpy2->SetLineColor(kBlue); hpxpy2->Draw("boxsame"); // points (markers) TCanvas *c2 = new TCanvas("c2","boxes",200,200,700,500); hpxpy->SetMarkerColor(kRed); hpxpy->Draw(); // default is scatter plot hpxpy2->SetMarkerColor(kBlue); hpxpy2->Draw("same"); // points (markers) TCanvas *c3 = new TCanvas("c3","cont3",300,300,700,500); hpxpy->SetLineColor(kRed); hpxpy->Draw("cont3"); // default is scatter plot hpxpy2->SetLineColor(kBlue); hpxpy2->Draw("cont3same"); c1->Modified(); gDirectory = gROOT; }