Re: Color option for TH2F->Draw

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Nov 11 1997 - 18:36:20 MET


Jayoung Wu wrote:

> *********************************************************************
> Hi,
> The above is part of my codes for 2D histogram with color option.
> By layer1->Draw("color"), a box is drawn for each cell with color scale
> (50 different color range) varying with contents. Actually I don't need
> 50 colors. Is there any way I can assign colors by contents?
> For example,   0.0001<= content < 0.001  dark blue
>                 0.001<=         < 0.01   light blue
>                 0.01 <=         < 0.1    light green
>                 0.1  <=         < 1.     dark green
>                 1    <=         < 10.    yellow
>                 10   <=         < 100.   red
>                 100. <=         < 1000.  purple
>

You can play with the following example macro illustrating how to set
a new color palette, set the number of contours and set the color
associated to a contour level.


{
   gROOT->Reset();
   TFile f("hsimple.root");
   Int_t colors[]={1,2,3,4,5,6,7,8,9,10};
   float levels[]={1,10,14,22,45,60,200,300,400,500,600,700};
   //the color corresponding to the minimum is the FillColor +1;
   hpxpy->SetFillColor(0);
   hpxpy->SetContour(6,levels);
   gStyle->SetPalette(10,colors);
   hpxpy->Draw("cont");
}

Rene Brun



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