[ROOT] 9 histograms on a 3 X 3 canvas

From: Venkatesh Kaushik (venkat@hepmail.uta.edu)
Date: Sat Nov 08 2003 - 02:18:44 MET


 HI ROOTERS,
 I have 33 histograms, do i have to define 33/9 = 4 canvases?
 Or can i define a single canvas and reuse the same canvas?
 I have a hard time understanding the
 canvas update and canvas modified methods and their use.

 Thanks for the help.
 Venkat.

    Here's what I do.

    const int num_hist = 33;
    const int num_canv = num_hist / 9 + 1 ;

    // Define as many canvases and their properties
   for(j = 0; j <= num_canv; j++) {
     Canv[j] = new TCanvas(Form("c%d",j), "",10,10,1000,900);
     Canv[j]->Divide(3,3);
   }

    ..
    ... more code here

    //Draw 9 histograms on one Canvas, 9 in the next, and so on..

   for(j = 1,Int_t k = 0; j <= num_hist; j++) {
     Canv[k]->cd(j % 10);
     h[j]->Draw();
     Canv[k]->Modified(); <----------------Can I get rid of this line
     Canv[k]->Update();   <----------------and this line?
    if( j % 10 == 0 ) {
	Canv[k]->Write(head[j]);
	k++;
    }
   }



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET