Hi Angela, Because, TH2 are often used to draw a pad frame, the TH2 Paint functions with options like "colz", "cont" return immediatly once the axes are drawn if the number of entries is null. There is no need to loop on the cell contents. If you use SetBinContent to fill your histogram, the number of entries is not incremented. Only the Fill functions increment the number of entries. In your case, simply add one statement before drawing your histogram: h->SetEntries(1); Rene Brun Angela Biselli wrote: > > Dear rooters, > I am having a weird (maybe stupid) problem with SetBinContent with the > latest version (v3.05.03). > If I set the bin of a 2D histogram, the histogram contains the bin-value > but when I draw the histogram it seems to be empty. > For example > root [1] TH2F *h=new TH2F("h","h",4,0,4,4,0,4) > root [2] h->SetBinContent(1,1,4) > root [3] h->Draw("colz") > My histogram is completely empty (just the axis are drawn) but if I do > root [4] h->GetBinContent(1,1) > (const Stat_t)4.00000000000000000e+00 > > I do not have this problem with 1D histograms, and I tried older versions > of root (e.g. 3.05.02) and I can see the bins I am filling with > SetBinContent. > Can anyone reproduce this problem? Am I doing something wrong? > > Thanks > Angela
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET