Color palette

Hi ROOTers
I have a 2D histogram like that one in attachment. I use the COL or COLZ option.
Some bins have a negative number of entries because of this histogram is the difference beetwen two other ones.
The palette is the default one.
I’m satisfied of it, but I like to set the color of bins with 0 entries with a specified color (green for example) indipendently of histo min and max.
How can I do it?
P.S. I use ROOT 5.18/00

Thanks in advance

Giovanni
plot.ps (318 KB)

Two examples:

The first one change the color index corresponding to one value:

{
   TCanvas *c  = new TCanvas("c","Contours",600,0,600,600);
   TF2 *f1 = new TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);
   gStyle->SetPalette(1);
   f2->SetContour(50);
   f2->Draw("colz");
   TH1 *h = f1->GetHistogram();
   if (h) SetValueColor(h, 0.7, 1., 1., 1.);
}

void SetValueColor(TH1 *h, Double_t z, Float_t r, Float_t g, Float_t b)
{
   Int_t ndiv     = gStyle->GetNumberContours();
   Int_t ncolors  = gStyle->GetNumberOfColors();
   Double_t zmin = h->GetMinimum();
   Double_t zmax = h->GetMaximum()*(1.+gStyle->GetHistTopMargin());
   Double_t dz = zmax - zmin;   
   Double_t scale = ndiv/dz;
   Int_t color = Int_t(0.01+(z-zmin)*scale);
   Int_t theColor = Int_t((color+0.99)*Float_t(ncolors)/Float_t(ndiv));
   TColor *cc = gROOT->GetColor(theColor+52);
   cc->SetRGB(r,g,b);
}

The second one redefine a completely new palette using TColor::CreateGradientColorTable with a white value around the level you want.

{
   TCanvas *c  = new TCanvas("c","Contours",600,0,600,600);
   TF2 *f1 = new TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);
   UInt_t Number = 3;
   Double_t Red[Number]    = { 0.00, 1.00, 1.00};
   Double_t Green[Number]  = { 0.00, 1.00, 0.00};
   Double_t Blue[Number]   = { 1.00, 1.00, 0.00};
   TH1 *h = f1->GetHistogram();
   Double_t zmin = h->GetMinimum();
   Double_t zmax = h->GetMaximum()*(1.+gStyle->GetHistTopMargin());
   Double_t z    = 0.7;
   Double_t v    = (z-zmin)/(zmax-zmin); 
   Double_t Length[Number] = { 0.00, v, 1.00 };   
   Int_t nb=50;
   TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
   f2->SetContour(nb);
   f2->Draw("colz");
}

I was looking for the code of the second example.
It works very well.
Thanks!!

Giovanni