Using predefined color palettes from root 6 to root 5

Hi,

I’m trying to used the kBlackBody colour palette for my histogram, unfortunately its only available on root 6 while I’m still using root 5.38. Is there any way for me to still use this palette?

You can create a palette
https://root.cern.ch/doc/master/classTColor.html#C05

using the colours you want. You can see the values for the predefined palettes here:
ROOT: core/base/src/TColor.cxx Source File
Scroll down to find Black Body (case 70). I’m not sure if the alpha option is available in ROOT 5, but you can just omit it, as in the “periodic z-axis” example above.

2 Likes

Thank you for your reply,

Looking at the link for the predefined palettes, I couldn’t find the values for the colour they used (red,green,blue,length). Is there a link for the source file that has these values for the predefined palettes, or should I try to solve this by trial & error?

The code is:

      // Dark Body Radiator
      case 53:
         {
            Double_t red[9]   = { 0./255., 45./255., 99./255., 156./255., 212./255., 230./255., 237./255., 234./255., 242./255.};
            Double_t green[9] = { 0./255.,  0./255.,  0./255.,  45./255., 101./255., 168./255., 238./255., 238./255., 243./255.};
            Double_t blue[9]  = { 0./255.,  1./255.,  1./255.,   3./255.,   9./255.,   8./255.,  11./255.,  95./255., 230./255.};
            Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
         }

Where is that link ?