Re: "[ROOT] how to shade one side of a graph"

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Aug 06 2002 - 12:50:46 MEST


Hi,

Here is an example

void fillg() {
   const Int_t n = 8;
   Double_t x[n] = {87,100,110,120,130,150,160,200};   
   Double_t y[n] = {1e-6,2e-6,2.5e-6,3e-6,3e-2,2e-1,3e-1,7e-1};
   Double_t xmin = 80, ymin = 1e-6, xmax = 200, ymax = 1;
   
   TGraph *g = new TGraph(n,x,y);
   
   TCanvas *c1 = new TCanvas("c1");
   c1->SetLogy();
   c1->DrawFrame(xmin,ymin,xmax,ymax);
   g->SetLineColor(2);
   g->Draw("l");

   //make a new graph using the previous graph points
   //+ the corner points of the pad.
   TGraph *gabove = new TGraph(n+3);
   for (Int_t i=0;i<n;i++) gabove->SetPoint(i,x[i],y[i]);
   gabove->SetPoint(n,xmax,ymax);
   gabove->SetPoint(n+1,xmin,ymax);
   gabove->SetPoint(n+2,xmin,ymin);
   gabove->SetFillColor(4);
   gabove->SetFillStyle(3012);
   gabove->Draw("f");
}
   
   
Rene Brun

On Tue, 6 Aug 2002, Subhendu Chakrabarti wrote:

> 
> Hi
> 	I want to give a dark shade on the upper side of the graph
> only .(see  attachment)
> 
> Can anybody give some idea how to do that ?
> 
> Thanks in advance .
>                
>         Subhendu Chakrabarti   
> 
>                 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:03 MET