Re: TPad::Divide()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 14 1999 - 18:22:43 MEST


Hi Faouzi, Paul,
NOOOOOOOOOOOOO. The TPad documentation is correct!!
Read this documentation correctly.
c1->cd(1) will set the current pad to the top left pad
of the divided canvas. c1->cd(0) is equivalent to c1->cd().
In your example, you call c1->cd(0). your macro cannot work.
In addition, I do not understand why you go through the interpreter
to execute this call. Simplify your logic to be:
 {
   gROOT->Reset();
   c1 = new TCanvas("c1", "Zoning ",200,10,900,700);
   c1.Divide(2,2) ;
   
   for(Int_t i=0 ; i < 4; i++) {
     c1->cd(i+1);
     fun = new TF1("fun","abs(sin(x)/x)",i,10.+i);
     fun->Draw() ;
   }
 }

Rene Brun



On Wed, 14 Apr 1999, Faouzi Attallah wrote:

> 
> Thanks Paul,
> 
> This is working, hope this will be corrected/added in the Root web page.
> 
> Cheers,
> Faouzi
> 
> > If you replace "c1.cd(%d) ;" with "c1_%d.cd() ;" and have i start
> > at 1 it should work.
> > 
> > 
> > > 
> > > Hi Rene,
> > > 
> > > I failed running a zoning program (hereafter an example) as suggested in 
> > > 	TPad.html#TPad:Divide
> > >     and           TPad:cd
> > > I get always the last Draw() within a full window. Did I miss something ?
> > > 
> > > Greetings,
> > > Faouzi
> > > 
> > >  {
> > >    gROOT->Reset();
> > >    char cmd[20] ;
> > >    
> > >    c1 = new TCanvas("c1", "Zoning ",200,10,900,700);
> > >    c1.Divide(2,2) ;
> > >    
> > >    for(Int_t i=0 ; i < 4; i++) {
> > >      sprintf(cmd,"c1.cd(%d) ;",i) ;
> > >      printf(" --> Cmd = %s ",cmd) ;  
> > >      gInterpreter->ProcessLine(cmd);
> > >      fun = new TF1("fun","abs(sin(x)/x)",1.*i,10.*i);
> > >      fun->Draw() ;
> > >    }
> > >       return ;
> > >  }
> > > 
> > > 
> > >  F. Attallah 
> > > GSI mbH 
> > > Planckstr 1
> > > D-64291 Darmstadt 
> > >   Tel: +49 (0)6159 71 2743
> > >   Fax: +49 (0)6159 71 2901
> > > Email: F.Attallah@gsi.de
> > > 
> > > 
> > 
> > 
> > -- 
> > Paul M. Eugenio
> > Dept. of Physics
> > Carnegie Mellon University
> > (412) 268 6949
> > eugenio@ernest.phys.cmu.edu
> > 
> > 
> >                 _____________________________________________________
> >                / The scholar should know; one builds science with    \
> >         o O 0 / the facts just like a house can be built of stones;   \
> >        o     | but an accumulation of facts is not a science just like |
> >   `\|||/      \           that a pile of stones is not a house.       /
> >    (o o)       \_____________________________________________________/
> > ooO_(_)_Ooo___________________________________________Henri Poincare'_
> > _____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____
> > __|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_
> > _____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|____
> > 
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:31 MET