# Normalizing a histogram

I want to normalize a histogram by dividing the number of entries in each bin by the total number of entries.I saw an example in the root manual. It goes as this:

Double_t scale = norm / h->Integral();
h1->Scale(scale);

what is norm ? do I have to define it before using the above functions ?

``                                                      thanks Debdatta.``

In this case, just set norm=1

Rene

HI Rene,
thanks for your help. I need some more help with the “lego” option. I used it on a 2-D histogram. The lines that make up the lego plot are very thin. Also the “floor” of the plot (if I am plotting x vs y lego plot, then the x-y plane) is completely black. How can I work around this ?

``                           thanks Debdatta.``

I guess you have an histogram with many bins along x and y axis ? I would recommand you to used the option SURF2 . This option doesn’t draw the cells’ edges and with many bins, as in your case, it should look very similar to LEGO.