Modify colorbar of histogramm

Hi,

assumin I have such a histogramm

TH2F foo("name", "name", 5, 0, 5, 5, 0, 5)
for (int i=0; i<500; i++){
    foo.Fill(rnd.Uniform(0,5), rnd.Uniform(0,5));
}
foo.SetStats(kFALSE)
foo.Draw("COLZ")

How can I change the colorbar from giving absolute numbers to show relativ fractions instead? E.g. I would like 1 as max entry and change the color to show x% of max entry instead of y entries. Is it possible to do somethin like newLabel = oldLabel / maxLabel? I am using Root 5.34, updating to a newer version would be difficult, so it would be perfect if the solution work with 5.34.

The axis along the colour palette displayed when you draw a 2D histogram is labeled according to the histogram content. If you need to have the % instead you should create a new histogram with bins’ content matching the scale you need.

Well you are right. I was so focused on changing the labels that I did not consider to divide the bin content by the max value. Thanks for the push to the right direction.

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