Set palette of histogram


_ROOT Version:5.34/10


Hi,
I have a two dimensional histogram that has positive and negative values. I use TColor::CreateGradientColorTable
to set the palette but I have the same colour(white) for zero values of histogram and those region of histogram that don’t have values. How can I differ these parts from the real zero values?
Thanks

What do you mean with “don’t have values”? Do you mean bins that haven’t been set to any value or haven’t been filled? Those are indistinguishable from bins that have been set to zero because when you create the histogram all bins are initialized to zero.

@couet - do we have a better answer than “set all bins to -1 to signal ‘empty’ and then draw with range”?

When bins have content 0 it is impossible to tell if the bin was never filled or if it was filled many times being in total 0. This is what we explain here (option COL1). I would suggest you first try to use COL1 instead of COL.

Actually, you could have a signature for “non-empty” bins with “zero contents” …

histo1D->Fill(x, 1.e-6); histo1D->Fill(x, -1.e-6);

Note: Empty bins are these that have the content equal to zero AND error equal to zero.

Thanks for your answer and sorry for delay,

I mean the bins haven’t been filled.

Thanks for your answer,
I can’t do it. The histogram has negative and positive values. This is my histogram
cos.pdf (47.7 KB)

I set the pallet to have the white colour for zero. There is no difference between the zero values of bins inside the shape and the bins that haven’t been filled around the shape.

May be follow Wille suggestion by putting Epsilons for filled bins close to 0.

Thanks, I couldn’t do this. I have positive and negative values to fill histogram and when I use setpallet I have the white colour for values between -0.01 to 0.01.
cos.pdf (47.7 KB)

You should create a palette with more colors such as white will represent only a tiny fraction of the palette around 0.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.