Hi,
If you do not want to see the 4 canvases together on the screen,
you need to define only one canvas. You can modify your code like
Canvas = new TCanvas(Form("canvas, "",10,10,1000,900);
Canvas->Divide(3,3);
for(j = 1,j <= num_hist; j++) {
Canvas->cd(j % 10);
h[j]->Draw();
Canvas->Update();
if( j % 10 == 0 ) {
Canvas->Write(head[j]);
}
Read the principles of Draw/Paint and Canvas/Modify/Update in
the Users Guide or at:
http://root.cern.ch/root/HowtoDraw.html
Rene Brun
On Fri, 7
Nov 2003, Venkatesh Kaushik wrote:
>
> 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