On Wed, Jun 07, 2006 at 05:36:41PM +0200, Olivier Couet wrote:
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
Just finished compiling it and tried your example. But I do not see how to use it in my case. My problem is, that I have something like z=f(x,y) and the area that I want to shade is "everything below z=excl". Additionally I can not easily solve f(x,y) for x or y analytically. That's why I used a TH2F to raster the area. Did I miss something? Maybe there is a way to extract the proper contour line easily into arrays so I can fill it into a TGraph? Did I miss that?
Thanks in advance!
> -----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) {
>          Shade->SetBinContent(
>                Shade->FindBin(x,y), 500);
>          }
>          else {
>          Shade->SetBinContent(
>                Shade->FindBin(x,y), 0);
>          }
>       }
>    }
>    Double_t contours[1];
>    contours[0] = excl;
>    Shade->SetContour(1, contours);
>    Shade->Draw("cont4");
> ----------------------------------------------------------------------
> 
> 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
-- 
Kind regards,                /                 War is Peace.
                            |            Freedom is Slavery.
Alexander Wagner            |         Ignorance is Strength.
                            |
                            | Theory     : G. Orwell, "1984"
                           /  In practice:   USA, since 2001
Received on Thu Jun 08 2006 - 10:43:03 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET