Re: How to Define a new Color Palette?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu May 20 1999 - 14:24:40 MEST


Hi Frederic,
With the current color/contour algorithm, you must define at least 2
more
colors than the number of contours. See small mod in your code below

Rene Brun

Frederic FAURE wrote:
> 
> ref: Pine.LNX.4.10.9905190723350.23938-100000@int_i.ri.dasa.de
> 
> Hi Rene,
> thank you very much for your response this problem.
> 
> But this does not work on my computer (IBM AIX):
> the top of the gaussian is not dark, but white.
> 
> I join the obtained picture.
> Perhaps is it due to my computer?
> 
> You gave me the following code:
> //-----------------------------------------
> 
> void palette()
> {
> //example of new colors (greys) and definition of a new palette
> 
> const Int_t colNum = 10;
> Int_t palette[colNum];
> for (Int_t i=0;i<colNum;i++) {
> TColor *color = new TColor(51+i
> ,1-(i/((colNum)*1.0))
> ,1-(i/((colNum)*1.0))
> ,1-(i/((colNum)*1.0)),"");
> palette[i] = 51+i;
> }
> gStyle->SetPalette(colNum,palette);
> 
> TF2 *f2 = new TF2("f2","exp(-(x^2) - (y^2))",-3,3,-3,3);
> f2->SetContour(colNum-2); //<I changed colNum to colNum-2
> f2->SetFillColor(0);
> f2->Draw("cont");
> }
> //------------------------------------------
> 
> --
> Frederic Faure
> LPMMC (Maison des Magisteres Jean Perrin, CNRS)
> BP 166 38042 Grenoble Cedex 9 France
> email: faure@labs.polycnrs-gre.fr
> tel: 04 76 88 74 98
> fax: 04 76 88 79 81
> 
>   ------------------------------------------------------------------------
>  [Image]



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