[ROOT] colz option in TH2 and TF2

From: Aldo F. Saavedra (AFSaavedra@lbl.gov)
Date: Wed Feb 20 2002 - 03:32:30 MET


HI Rene, Valeri and everyone else,

My aim was to plot a contour map of a 2d histogram
using a pre-determine levels and to each level
assign a colour.

I followed the manual's instructions but I found
something peculiar.

With TF2:

 Option   levels set  colours def    graph   colour scale
  colz        none        5          good      matched the graph
				  5 different
				  equidistant
				  levels

  colz         3          5         bad 		same as
				ignored SetContour     previous test
				still shows 5
				 different
				equidistant level

  contz      none         5         good		matched the graph
			          showed five regions

  contz        3	  5         good.. show      has not changeds
				 three colours    still shows 5 colours

  lego2z      none        5    	good.. five regions    bad, the colour
				with different		scale did not
				colours  		match the graph

  lego2z       3 	  5    good.. shows three	bad, the colour
				colours at the		scale did not
				correct levels		match the graph
			       although the colours
				are different
				from contz and colz

  surf2z     none         5     good.. five regions	matches the graph
				with different
				colours.. the colours
				match the previous
				graphs when the
				levels were not set

  surf2z     3            5     good correct levels	bad the colour
				although colours	scale did not
				are different again	match the graph
							it is the same
							as before

TH2:
 Option   levels set  colours def    graph       colour scale
  colz      none          5           good        good as expected

  colz       3            5          bad still     the same scale as the
				   shows five		previous test
				  contour regions

  contz      none         5          good            good, same as
							previous test

  contz      3   	  5	    good, three		bad.. it shows
				different colours     the same scale as
							the previous
							test

  lego2z     none         5          good 		 good

  lego2z      3           5          good                bad, the scale
							does not represent
							graph.. same
							problem as before

I found this in the linux version 3.02/7 and in the windows
version 3.02/6. (the two versions were compiled from the
sources)  I include the two scripts that I used
to perform the tests.. tf2_contour.c  and histo_contour.c ..

My question is, is it me or is it a bug?


I was wondering why when defining a level I can't define
the colour that will be associated with that level.
It would make life so much easier ;)
 At the moment it seems that there is very little control
over which colours belong to which levels.


I have two different palettes which I used but
calling SetPalette with different colours
starting at the same index does not seem
to overwrite the previous colours.. only
the empty slots get overwritten..
so the other question that I have is how
to reset the palette. The reason is
that one 2D histogram needs a gradual
colour change.. the other needs distinctive
colours.


 for example
 case 0:
 {
      const int colNum = 20;
      int k;
      k=0;
      for (i=0;i<colNum;i++)
      {
	TColor *color = new TColor(250+i,0.0,0.0,1.0 -Float_t(k)/12,"");
        i++;
	palette[i] = 250+i;
      }
      gStyle->SetPalette(colNum,palette);
    }
  break;
  case 1: // for the wafer map of the good column pairs, one colour
          // for each value.. only 10 values
    {
      const int colNum = 5;
      int palette[colNum];

      float green,red,blue;
      for (i=0;i<colNum;i++)
      {
        switch(i)
        {
        case 0:  red=1.0;green=1.0;blue=1.0;break; // no chip read
        case 1:  red=1.0;green=0.0;blue=0.0;break; // no global
        case 2:  red=1.0;green=0.5;blue=0.5;break; // global
        case 3:  red=1.0;green=1.0;blue=0.0;break; // 1 col
        case 4:  red=1.0;green=0.5;blue=0.0;break; // 2
        case 5:  red=1.0;green=1.0;blue=0.5;break; // 3
        }

        TColor *color = new TColor(250+i,red,green,blue,"");

	palette[i] = 250+i;
      }
      gStyle->SetPalette(colNum,palette);
    }
    break;

So before I draw each different 2d histogram
I call the particular case that I need.
I only get the correct colour is it is
the first one to be called.. otherwise
I get a mixture between the two
because one is greater than the other.

Any enlightment would be useful.

thank you,
Aldo

***********************************************************
 Aldo F. Saavedra
 ATLAS Collaboration - Pixel Group (Physics Division)
 Lawrence Berkeley National Laboratory

 Email:          AFSaavedra@lbl.gov
 Phone:          1 510 486 4690
 Fax:		 1 510 486 5101
 Postal Address: Lawrence Berkeley National Laboratory
                 1 Cyclotron Rd Mailstop 50B-6208
                 Berkeley, CA 94720
                 USA






This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:42 MET