Re: Making own Palette

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Jul 17 1997 - 12:01:35 MEST


The default fill color for a TF2 is color 19 (gray).
When drawing with the option "surf2", the current algorithm paints 
a given contour level N with Color number N + Current FillColor.
You can set the fill color to 0 to get a one to one correspondance
between contour number and color number.
I have added the corresponding line in your example below

Rene Brun


Marc Mueller wrote:
> 
> 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);
     f2->SetFillColor(0);  // <========new line
>    pad1->cd();
>    pad1->SetPhi(-70);
>    pad1->SetTheta(25);
>    pad1->SetLogz();
>    f2->Draw("surf2");
> }



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:20 MET