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

From: Subhendu Chakrabarti (subhendu@tifr.res.in)
Date: Tue Aug 06 2002 - 13:36:07 MEST


Thanks. This works nicely .But If I want to save it in a postscript file
by adding
c1->Print("new.ps"); to the macro ,shaded region disappears,graph prints.
               
        Subhendu Chakrabarti   

                

On Tue, 6 Aug 2002, Rene Brun wrote:

> 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