Extra page when using Clear() in a post script file

Hi ROOTers,

 I'm trying to make a histogram where on the first two pages I draw 4 histos on each page, on the third page I only want to draw one. I only want three pages but when I use the following code I get four pages ("ps" is the postscript file, "can1" is my canvas):

ps.NewPage()
can1->Divide(2,2)
histo1->Draw()

ps.NewPage()
can1->Divide(2,2)
histo5->Draw()

can1->Clear()
histo9->Draw()

It’s not essential to my research to remove that extra page, it’s just annoying to have everytime I open my ps file.

Great Thanks!!

  • Arya

Can you provide a small running macro reproducing the problem ?

void qcd_part()
{
	
	TH1F *h_JetPt = new TH1F("h_JetPt","Pt of all jets",300,0,4000);
	
		TCanvas* can1 = new TCanvas("can1","The Ntuple canvas",200,10,600,450);
	TPostScript ps("/home/aafshari/workarea/qcd/mc12/qcd_part.ps",112);
	
	ps.NewPage();
	can1->Divide(2,1);
	can1->cd(1);
	gPad->SetLogy(1);
//	gPad->SetLogx(1);
	h_JetPt->Draw();
	can1->cd(2);
	gPad->SetLogx(0);
	gPad->SetLogy(1);
	h_JetPt->Draw();
	can1->Update();
	
	ps.NewPage();
	can1->Divide(2,1);
	can1->cd(1);
	gPad->SetLogy(1);
//	gPad->SetLogx(1);
	h_JetPt->Draw();
	can1->cd(2);
	gPad->SetLogx(0);
	gPad->SetLogy(1);
	h_JetPt->Draw();
	can1->Update();

	ps.NewPage();
	can1->Clear();
	gPad->SetLogy(1);
	h_JetPt->Draw();
	can1->Update();
	
	can1->Close();
	ps.Close();
	
	cout << "\n done" << endl << endl;
}

basically, I want to get rid of the pad divisions and only have one pad on the last page.
Thanks for your help!!

I think it is much simpler to do something like:

{

TFile f("hsimple.root","READ");
c1 = new TCanvas("c1","sub data",200,10,700,500);

hpx->Draw();
c1->Print("h1.ps(");
c1->Print("h1.ps");
c1->Print("h1.ps");
c1->Print("h1.ps");
c1->Print("h1.ps)");

}