Can't divide canvas

here i have 12 histograms and i want to draw 6 histogram in one canvas and another 6 histogram in another canvas
so i create two canvas, here i can divide the first canvas into six pad but not the second histogram
here is my code

    TCanvas *c = new TCanvas("myCanvas1","Xlayer_Occupancy",1500,1000);
c->Divide(3,2);
TCanvas *ce = new TCanvas("mycanvas2","Xlayer_Occupancy",1500,1000);
ce->Divide(3,2);
   ......
  .......
   for(int kj=0;kj<NL;kj++) {
if(kj<6)
{
c->cd();
c->cd(kj+1);
occux[kj]->Draw();
}
if(kj>5)
{
ce->cd();
ce->cd(kj+1);
occux[kj]->Draw();
}}
void div2canvases()
{
   TCanvas *C1 = new TCanvas("C1","C1",800,600);
   C1->Divide(3,2);
   TCanvas *C2 = new TCanvas("C2","C2",0,650,800,600);
   C2->Divide(3,2);

   for (int i=1; i<=6; i++) {
      C1->cd(i);
      gPad->DrawFrame(0,0,1,1);
   }
   for (int j=1; j<=6; j++) {
      C2->cd(j);
      gPad->DrawFrame(0,0,1,1);
   }
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.