{// Simplified version of root/tutorials/hist/h2proj.C TH2F *h2 = new TH2F("h2","",3,0,3, 3,0,3); for (Int_t i = 0; i < 3; i++) { for (Int_t j = 0; j < 3; j++) h2->Fill(0.5+i,0.5+j); } // we have 1 entry in each bin, so 9 entries in total // The problem is in h2->ProjectionY("",bin,bin+1) (or h2->ProjectionX("",bin,bin+1)) // three Projections in Y (or X) have entries: 6, 6, 3, while we expect 3, 3, 3 TCanvas *cs = new TCanvas("cs","slices",900,900); cs->Divide(2,2); const int n=4; TH1 *hbins[n] ; for (int i=0;iProjectionY(Form("bin%d",i),i+1,i+2); } for (int i=0;icd(i+1); hbins[i]->Draw("");} }