Controlling the palette

Hello all,

I would like to control which colours are used in the palette. I currently use
gStyle->SetPalette(1);
and am displaying TH2D histograms using the h->Draw(“COLZ”); option.

The problem I have is that when comparing 2 different histograms the palette scales can be different. For example, if the entries in h1 vary from 0 to 50, but for h2 they vary from 0 to 70, then the red colour in h1 represents 50 but in h2 red represents 70. This makes comparison by eye difficult, especially when looking at greens and yellows.

Is there a way that I can set the lowest colour to be 0 and the highest colour to be, say, 100? Then have all histograms follow this strict colour code.

change the histogram maximum (and minimum) to the same value:

h1->SetMaximum(100)
h2->SetMaximum(100)

Brilliant, thanks very much.