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
Can I generate 50 colours between kGreen - 10 and kGreen +2?
couet
January 13, 2020, 12:38pm
4
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;
TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
f2->SetContour(nb);
f2->SetLineWidth(1);
f2->SetLineColor(kBlack);
f2->Draw("surf1z");
}
1 Like
system
Closed
January 27, 2020, 12:38pm
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.