void testPrintSubPad() { //create Canvas with 3 subpad// TCanvas * MyC = new TCanvas("MyC","Canvas",-1,1,3*300,300); MyC->Divide(3,1,0.0001,0.0001); //Set up the pads// for (int i=1;i<=3;++i) { MyC->cd(i); gPad->SetRightMargin(0.17); gPad->SetLeftMargin(0.11); gPad->SetTopMargin(0.14); gPad->SetBottomMargin(0.14); } //create a 2D Histo to fill the subpads with something// TH2D * twod = new TH2D("twod","TEST 2D",200,-4,4,200,-4,4); //filling 2D Histo// Double_t px,py; for (Int_t i = 0; i < 500000; i++) { gRandom->Rannor(px,py); twod->Fill(px,py); } //setting up 2D Histo// twod->SetOption("colz"); twod->SetXTitle("x Title"); twod->SetYTitle("y Title"); twod->GetXaxis()->CenterTitle(true); twod->GetYaxis()->CenterTitle(true); //draw the Histo into the different pads// for (int i=1;i<=3;++i) { MyC->cd(i); twod->DrawClone(); } //upadate the Canvas// MyC->Update(); //print the pads pad 0 ist the whole canvas// for (int i=0;i<=3;++i) { MyC->cd(i); gPad->Print(Form("pad%d.pdf",i)); gPad->Print(Form("pad%d.gif",i)); } }