CreateGradientColorTable

Hi, I am a newbie so go easy on me.

I plot my data using a 2D histogram plot with the “colz” option.
I have a customized GradientColorTable a la:

[code]// Create linear gradient color table
UInt_t Number = 20;

Double_t Red[Number] = { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.25,
0.50, 0.75, 1.00, 1.00, 1.00, 0.95, 0.85, 0.70, 0.55, 0.30 };

Double_t Green[Number] = { 0.00, 0.00, 0.00, 0.00, 0.00, 0.25, 0.50, 0.75, 1.00, 1.00,
1.00, 1.00, 1.00, 0.85, 0.75, 0.50, 0.10, 0.00, 0.00, 0.00 };

Double_t Blue[Number] = { 0.30, 0.55, 0.70, 0.85, 0.95, 1.00, 1.00, 1.00, 1.00, 0.75,
0.25, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00 };

Double_t Stops[Number] = { 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45,
0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 1.00 };

gStyle->CreateGradientColorTable(Number,Stops,Red,Green,Blue,250);[/code]
as instructed in the documentation.

However I would like a smoother color gradient (rather than just a 20 color range), so, I have created a new color table, with 50 entries, similar to the one above. Instead of a smoother, 50 color gradient, I still only have 20 different colors appearing in the key. Is there a simple way to get a smoother color gradient with say 64 or 128 colors in it?

Thanks in advance

Try this:

{
TCanvas c = new TCanvas(“c”,“Contours”,600,0,600,600);
TF2 f1 = new TF2(“f2”,"0.1+(1-(x-2)(x-2))
(1-(y-2)*(y-2))",1,3,1,3);
UInt_t Number = 3;
Double_t Red[Number] = { 1.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};
Double_t Stops[Number] = { 0.00, 0.50, 1.00 };
Int_t nb = 50;
Int_t i=gStyle->CreateGradientColorTable(Number,Stops,Red,Green,Blue,nb);
f2->SetContour(nb);
f2->Draw(“colz”);
}

Excellent, many thanks