On Fri, 17 Aug 2001, Nicolas de Sereville wrote
Hi Nicolas,
I guess you have a problem in your index for the subpads,
they should run from 1, your loop (i) runs from 0
Cheers
Otto
>
> I want to divide a canvas into 16 sub-pads and draw in each one, let's say
> the same histogram. I did two different ways. The first one is something
> like that :
> c1->Divide(4,4);
> c1->cd(1);
> h137->Draw();
> c1->cd(2);
> h138->Draw();
> c1->cd(3);
> h139->Draw();
> ..... and so on. It works well but it's not realy satisfaying!
>
>
> The second way, I do a loop over the sub-pad with the following macro. The
> only result I obtain is the graph of the last histogram drawed not in a
> sub-pad but in the whole canvas!!
>
> void nico(Int_t secteur)
> {
> TFile *f = new TFile("file.root");
> TCanvas *c1 = new TCanvas("c1","c1",1000,800);
> c1->Divide(4,4);
>
> for(Int_t i = 0; i < 16; i++){
> Char_t h[4];
> Int_t s = secteur * 16 + 128;
>
> c1->cd(i+1);
^^^^^
subpad run from 1
> sprintf(h,"h%3d",s+i+1);
> TH1F *histo = (TH1F*) gFile->Get(h);
> histo->Draw();
> }
> }
>
> Can anybody tell me what is the difference between the two methods?
> Thanks in advance.
>
> Nicolas.
>
> P.S : I am using ROOT 3.00/01 on a Sun ultra 10
> --
> :-------------------------------:
> : Nicolas DE SEREVILLE :
> : C.S.N.S.M. :
> : Batiment 104 :
> : 91405 ORSAY Campus :
> : Tel : (+ 33) (0)1 69 15 48 57 :
> : Fax : (+ 33) (0)1 69 15 50 08 :
> :-------------------------------:
>
>
>
>
Otto Schaile Sektion Physik, LMU Muenchen
Phone: +49 89 289 14070 Am Coulombwall 1, D-85748 Garching, Germany
GSM: +49 160 1553598
FAX: +49 89 289 14072 EMail: Otto.Schaile@Physik.Uni-Muenchen.DE
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET