Draw a 2d histogram with text and col options

Hi all,

I have a 2d histogram with values ranging in a large interval (from -1e12 to 1e20) and I would like to get a plot with colored cells, each with a number showing the histogram bin content.

In order to do that, I tried to do something like this:

histo->DrawCopy(“col”);
histo->DrawCopy(“textsame”);

and it works well.

However, since the contents of many bins are almost close to each other, almost all the cells are drawn with the same color. In order to have more colours in the plot, I have tried to use the Logz option in the pad, with the command

gPad->SetLogz();

and, when I use this options, the colors of the cells look good. However, when drawing the histogram in text mode, the texts with the negative values disappear from the plot. It seems that the Logz options suppresses the negative values even in the text option. This happens even if I change the order of the draw commands. Is there a way of make negative value appear in the texts even using the Logz option?

… and it also suppress the cells with negative content in the color plot because the log of a negative or null number is not defined. When the maximum of the histogram is positive and the minimum negative or null we try nevertheless to draw something by starting to draw 3 decades below the maximum.
To increase the number of color you can also define a palette with more colors:
root.cern.ch/root/html/TColor.html#C05

Thanks for your answer, I’ll try to play with palettes :smiley: