Color palette range centred around zero

Hello,
I have a 2D histogram with bin content ranging between -1 and 1. How can I use the palette colors such that the minimum is 0 and the max is 1 and -1? So that I can have the same colors for 1 and -1 (with similar colors for 0 to +1 as it is for 0 to -1) but still plot the entire range of -1 to 1 of the histogram.

I am currently no using any other options other than:
hist->Draw(“colz text0”);

Thank you very much for your help!

You can define your own palette using the same colour as “lowest” and “highest”. For example, you could take the second example from the documentation and just make the first and last elements of the Red, Green and Blue arrays equal; for instance:

   Double_t Red[Number]    = { 0.00, 0.00, 0.00};
   Double_t Green[Number]  = { 0.00, 1.00, 0.00};
   Double_t Blue[Number]   = { 1.00, 0.00, 1.00};

(if you see these as a matrix, each column defines a colour, so you need the first and last columns to be the same). Play with nb to change the gradation.

This example might be helpful also.

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