Maximum and minimum colour using the "COL" option in TH1::Draw

When using the “COL” option for TH1::Draw() can I specify a colour for the minimum, e.g. light red and a colour for the maximum, e.g. dark red expecting a smooth transition of colours for the intermediary values?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Color palettes

Can I generate 50 colours between kGreen - 10 and kGreen +2?

Yes you can:

   TF2 *f2 = new TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);
   const Int_t Number = 2;
   TColor *col1 = gROOT->GetColor(kGreen-10);
   TColor *col2 = gROOT->GetColor(kGreen+2);
   Double_t Red[Number]    = { col1->GetRed()   , col2->GetRed()};
   Double_t Green[Number]  = { col1->GetGreen() , col2->GetGreen()};
   Double_t Blue[Number]   = { col1->GetBlue()  , col2->GetBlue()};
   Double_t Length[Number] = { 0.00, 1.00 };
   Int_t nb=50;

1 Like

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