Re: [ROOT] color palette/grayscale

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Tue Mar 02 2004 - 09:24:12 MET


You can define more than 50 color. See the help of SetPalette in TStyle:

void TStyle::SetPalette(Int_t ncolors, Int_t *colors)
{
// The color palette is used by the histogram classes
//  (see TH1::Draw options).
// For example TH1::Draw("col") draws a 2-D histogram with cells
// represented by a box filled with a color CI function of the cell 
content.
// if the cell content is N, the color CI used will be the color number
// in colors[N],etc. If the maximum cell content is > ncolors, all
// cell contents are scaled to ncolors.
//
// if ncolors <= 0 a default palette (see below) of 50 colors is defined.
//     the colors defined in this palette are OK for coloring pads, labels
//
// if ncolors == 1 && colors == 0, then
//     a Pretty Palette with a Spectrum Violet->Red is created.
//   It is recommended to use this Pretty palette when drawing legos,
//   surfaces or contours.  
//
// if ncolors > 50 and colors=0, the DeepSea palette is used.
//     (see TStyle::CreateGradientColorTable for more details)
//
// if ncolors > 0 and colors = 0, the default palette is used
// with a maximum of ncolors.
//
// The default palette defines:
//   index 0->9   : grey colors from light to dark grey
//   index 10->19 : "brown" colors
//   index 20->29 : "blueish" colors
//   index 30->39 : "redish" colors
//   index 40->49 : basic colors
//
//  The color numbers specified in the palette can be viewed by selecting
//  the item "colors" in the "VIEW" menu of the canvas toolbar.
//  The color parameters can be changed via TColor::SetRGB.

This function is accessed via:

gStyle->SetPalette();

 Cheers,    O.Couet

On Mon, 1 Mar 2004, Woon-Seng Choong wrote:

>    I have question concerning the color palette and the number of colors 
> that one can defined in ROOT.  I am interested in using ROOT to view a 
> 2D image  in grayscale (black and white) using the 2D histogram. I need 
> a grayscale of at least 8 bits.  As far as I can understand it, ROOT 
> has a maximum of 50 colors.  Is there a way to get more colors, in 
> particular in grayscale? If not, is this a feature that would be added 
> in the future?
> 
> 	Seng
> 
> 

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET