TH2::Draw("colz") behavior changed

I am evaluating the new version of root - 4.00/4 on win32gdk. I have a 2D histogram that has bin contents of non-empty cells negative. With the present version of root, TH2::Draw(“colz”) draws the empty bins with the color of the maximum bin contents. In version 3.10/2, the empty bins were “white” (e.g. background color)

Note: if the non-empty cells are positive, the empty cells are displayed as background color (e.g. white) - this is the desired behavior in both cases.

IS there a work-around I can try? Thanks

Ed

Yes, we did that on purpose. The THistPainter CVS log says:

revision 1.168
date: 2004/03/25 18:09:11; author: brun; state: Exp; lines: +3 -3
From Olivier:

  • Two improvements in PaintColorLevels:
    1. Because of rounding errors, it may happened that a cell’s color was
      outside the palette even for a z value smaller than the maximum.
    2. The bins with zero content are not painted only if the minimum of the
      histogram isn’t negative.

Point 2) is what you refer to. If an histogram has negative entries, it means it has not been filled with positive weights only and therefore a bin containing 0 is not necessarily empty !

I am using win32gdk 4.00/4 from CVS today (3-Jun-04). The attached root file contains a 2D histogram, pXyTof. Read and display as follows:TFile *f = new TFile("colz.root"); gStyle->SetPalette(1,0); pTofXy->Draw("colz");My question is: How do I change the color of the largest countour (199) from red to, “white” (or what ever the canvas’s color is - perhaps 19?)

Here are some curious things that seem not right…
(1) Around x=-13.7, y=9.4 there are some pixels drawn in colors that do not appear on the palette (this is the color I’d like to chage red to!)
(2) When you zoom in the y-axis and then unzoom, the z-axis unzooms as well (x-axis does not behave this way)

Ed
colz.root (110 KB)

one possible way:

{
   TFile *f = new TFile("colz.root");

   Int_t ncol = 100;
   Int_t colors[ncol];
 
   Float_t  saturation = 1;
   Float_t  lightness = 0.5;
   Float_t  MaxHue = 280;
   Float_t  MinHue = 0;
   Int_t    MaxPretty = 50;
   Float_t  hue,r,g,b;
   for (Int_t i=0 ; i<ncol ; i++) {
      colors[i]= i+100;
      col = gROOT->GetColor(colors[i]);
      hue = MaxHue-(i+1)*((MaxHue-MinHue)/ncol);
      TColor::HLStoRGB(hue, lightness, saturation, r, g, b);
      if(i<ncol-1) {
         col->SetRGB(r, g, b);
      } else {
         col->SetRGB(1, 1, 1);
      }
   }
 
   pTofXy->SetContour(ncol);
   gStyle->SetPalette(100,colors);
   pTofXy->Draw("colz");
}