Re: Re: [ROOT] Shades of gray

From: Stephen Bailey (bailey@SLAC.stanford.edu)
Date: Tue Aug 14 2001 - 15:32:44 MEST


Hi.

As I understand it, the TColor constructor takes an RGB value.
So, e.g., to create 100 shades of green, try replacing the
TColor construction with:

      TColor *color = new TColor(501+i, 0, 1-Float_t(i)/colNum, 0, "");

or whatever other 100 combinations of RGB you want to try.

Stephen

On Tue, 14 Aug 2001, Chris Milne wrote:

> Hi there,
>
> Can anyone help, I was interested in the below message and have used it myself,
> however I am more interested in 100 colours than 100 shades of grey. Can someone
> tell me what alteration is needed
>
> Thanks
> Chris Milne
>
> >Hi Adam,
> >
> >//example of new colors (greys) and definition of a new palette
> >void palette() {
> >   const Int_t colNum = 100;
> >   Int_t palette[colNum];
> >   for (Int_t i=0;i<colNum;i++) {
> >      TColor *color = new TColor(501+i
> >                                ,1-Float_t(i)/colNum
> >                                ,1-Float_t(i)/colNum
> >                                ,1-Float_t(i)/colNum,"");
> >      palette[i] = 501+i;
> >   }
> >   gStyle->SetPalette(colNum,palette);
> >
> >   TF2 *f2 = new TF2("f2","exp(-(x^2) - (y^2))",-1.5,1.5,-1.5,1.5);
> >   f2->SetContour(colNum);
> >   f2->Draw("contz");
> >}
> >
> >Rene Brun
> >
> >On Mon, 13 Aug 2001, Adam Bouchta wrote:
> >
> >
> >>  Hello,
> >>
> >> I wonder how one can expand the number of gray-levels in the palette? For
> >> the moment I just limit the number of colors to 9 and get that number of
> >> grays. How can one get 100 or so levels?
> >>
> >> Thanks,
> >>
> >>       Adam.
> >>
>
>



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET