Making a custom palette based on kBird

Hi Everyone,

I wanted to make a few plots with a colour palette that was based on the kBird one, however I wanted to remove the most yellow colours.

Now I was looking around, but I can’t find a way to get a handle on the colours inside the kBird colour palette. Does this exist?

Cheers,
Nikkie


_ROOT Version:6.14/08
_Platform:CC7 - cern
_Compiler:linuxx8664gcc


This is how kBird is defined:

{
   TCanvas *c  = new TCanvas("c","Contours",600,0,600,600);
   TF2 *f2 = new TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);

   Double_t red[9]   = { 0.2082, 0.0592, 0.0780, 0.0232, 0.1802, 0.5301, 0.8186, 0.9956, 0.9764};
   Double_t green[9] = { 0.1664, 0.3599, 0.5041, 0.6419, 0.7178, 0.7492, 0.7328, 0.7862, 0.9832};
   Double_t blue[9]  = { 0.5293, 0.8684, 0.8385, 0.7914, 0.6425, 0.4662, 0.3499, 0.1968, 0.0539};
   Double_t stops[9] = { 0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000};
   Int_t nb=255;
   TColor::CreateGradientColorTable(9, stops, red, green, blue, nb);
   f2->SetContour(nb);
   f2->Draw("colz");
}

Play with the red green and blue values to define your own palette based on kBird

Thanks a lot!

Is there a place where one can find this information for the other palettes too? Because I was clicking around in the root documentation and I couldn’t get here.

Cheers,
Nikkie

In the TColor.cxx code.
https://root.cern/doc/master/TColor_8cxx_source.html

1 Like

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