Making own Palette

Marc Mueller (mmueller@wiwi.uni-bielefeld.de)
Tue, 15 Jul 1997 10:25:45 +0200


Hi,
I'd like to set my own colors in a contour plot. This small
program does it,but the contour colors are not in the order
I defined it. Does anybody know how the order of contour colors
can be set?

Thanks in advance,
Marc Mueller

mmueller@wiwi.uni-bielefeld.de

{
gROOT->Reset();
int colNum=32;
int colPoint=51;

colorList=gROOT->GetListOfColors();
while(colorList.LastIndex()>0)
colorList.RemoveLast();

int mypalette[colNum];
for ( int i=0; i<colNum; i++)
{
TColor(i+colPoint,1-(i/(colNum*1.0)),1-(i/(colNum*1.0)),
(i/(colNum*1.0))," ");
if((i+colPoint)<100) {
colorList.RemoveLast(); //TColor *light
colorList.RemoveLast(); //TColor *dark
}
mypalette[i]=i+colPoint;
}
c1 = new TCanvas("prtname","Surface Draw",200,10,700,500);
gStyle->SetPalette(colNum,mypalette);

pad1 = new TPad("pad1","Title",0.02,0.02,0.98,0.98,10);
pad1->Draw();
TF2 *f2 = new TF2("f2","(x^2) + (y^2) - (x^3) -9*x*(y^4)",-2,1,-3,3);
f2->SetContour(colNum);
pad1->cd();
pad1->SetPhi(-70);
pad1->SetTheta(25);
pad1->SetLogz();
f2->Draw("surf2");
}