# RE: Filling area under a curve

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Wed, 7 Jun 2006 17:36:41 +0200

Hi,

I have recently implemented this in TGraph. See \$ROOTSYS/tutorials/graphpolar.C
This has been introduced in the last ROOT release. See: http://root.cern.ch/root/Version511.news.html

Cheers, Olivier Couet

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Alexander Wagner Sent: Wednesday, June 07, 2006 5:13 PM
To: Roottalk
Subject: [ROOT] Filling area under a curve

Hi!

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) {

}
else {

}
}
```

}
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?

(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:36:47 MEST

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