Filling area under a curve

From: Alexander Wagner <>
Date: Wed, 7 Jun 2006 17:13:04 +0200


In some of my plots I want to show an excluded area by just shading it in gray. To this end I tried the following

   TH2F *Shade = new TH2F("excl", "", xbins, xmin, xmax, ybins, ymin, ymax);

   for( Double_t x = xmin; x < xmax; x += (xmax-xmin)/xbins) {

      for(Double_t y = ymin; y < ymax; y += (ymax-ymin)/ybins) {
         val = curve(y, x);
         if (val <= excl) {
               Shade->FindBin(x,y), 500);

else { Shade->SetBinContent( Shade->FindBin(x,y), 0);

   Double_t contours[1];
   contours[0] = excl;
   Shade->SetContour(1, contours);

Now, unfortunately root fills the area _above_ the curve in black (I did not even find how to change that colour) and not the one below. I always get it displayed in white, wheras I'd like something like gray70. Actually the area above the curve should be transparent so that I could Draw("cont4,same"), above another graph. Searching arround did not give me a clue (though I came accros some other interesting things ;)

Does anybody have a hint how to do this?

Many thanks in advance!

(Running root 5.10/00 @debian sarge.)


Kind regards,                /                 War is Peace.
                            |            Freedom is Slavery.
Alexander Wagner            |         Ignorance is Strength.
                            | Theory     : G. Orwell, "1984"
                           /  In practice:   USA, since 2001
Received on Wed Jun 07 2006 - 17:11:16 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET