Re: CINT Macros cannot draw in loops?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 16 2000 - 09:19:59 MET


Just a small addition:
  canvas->cd();  // set current pad to canvas itself
  canvas->cd(0); //same as above
  canvas->cd(1); //set current pad the first subpad

Rene Brun

Aihong Tang wrote:
> 
> The index of sub pads begin with 1 instead of 0.
> Try to modify your for loop as:
> 
> for (Int_t i=1; i<3; i++){
>            ^^^
>   canvas->cd(i);
>   ...
> }
> 
> Best Regards.
> Aihong
> 
> On Tue, 15 Feb 2000, Burt Holzman wrote:
> 
> > Hello, ROOTers.
> >
> > I don't know if this is a known problem (or feature), but if I
> > attempt to split up a canvas and draw inside of a for loop, ROOT
> > seems to ignore the TCanvas::Divide() and just draw the objects
> > at the end.  A short sample macro is below.  Am I doing something
> > wrong?
> >
> > - B
> >
> > ----
> >
> > {
> >   TCanvas *canvas = new TCanvas("canvas", "canvas");
> >   canvas->Divide(1,2);
> >   TF1 *func[2];
> >
> >   TF1 *func[0] = new TF1("func[1]", "sin(x)", 0, 5);
> >   TF1 *func[1] = new TF1("func[1]", "cos(x)", 0, 5);
> >   for (Int_t i=0; i<2; ++i) {
> >     canvas->cd(i);
> >     func[i]->Draw();
> >   }
> > }
> >



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET