New canvas overwrites output in postscript file

Hi,
if I redirect the output into a postscript file with help of TPostScript, the last plot gets overwritten with an white area. (If you redisplay the resulting plot in gv, you will see, that the second plot is there, but is behind an white area). If I insert a TPostScript::NewPage, I get an additional spare area, which I don’t want to have.
Is there a possibility to prevent the empty (new) canvas to be drawn above the last histogram in the the first canvas?

Cheers, J.

[code]
void testpost()
{

ps = new TPostScript(“file.ps”,121);

h=new TH1F(“h1”,“h1”,100,-3,3);
h->FillRandom(“gaus”,10000);

c = new TCanvas(“blah”,“blah”);
h->Draw();
c->Update();

h->FillRandom(“gaus”,10000);
h->Draw();
c->Update();

// ps->NewPage();
c = new TCanvas(“blubb”,“blubb”);
h->FillRandom(“gaus”,10000);
h->Draw();
c->Update();

ps->Close();

gSystem->Exec(“gv file.ps&”);

}[/code]
testpost.C (416 Bytes)

I suggest a simplification of your code exploiting the “(”, “)” syntax in TPad::Print.
see doc of TPad::Print at: root.cern.ch/root/html/TPad.html#TPad:Print

[code]void testpost()
{
h=new TH1F(“h1”,“h1”,100,-3,3);
h->FillRandom(“gaus”,10000);

c = new TCanvas(“blah”,“blah”);
h->Draw();
c->Print(“file.ps(”);

h->FillRandom(“gaus”,10000);
h->Draw();
c->Print(“file.ps”);

// ps->NewPage();
c = new TCanvas(“blubb”,“blubb”);
h->FillRandom(“gaus”,10000);
h->Draw();
c->Print(“file.ps)”);
//gSystem->Exec(“gv file.ps&”);

}
[/code]

Hi,

I 've choosen to use the TPostScript class, because I did not find a way to change the page layout in the same way like ps = new TPostScript("file.ps",121); does.

How is it possible to print the content of two different canvases on the same page with the TPad::Print syntax?

Cheers, J.

The capability of splitting the output page using the PS file type convention as documented in the TPostScript header was imported from the old CERNLIB graphics package HIGZ. It has never been really tested in the ROOT context. In ROOT, to achieve this result, we would recommend to use the gPad->Divide().

May be we should not continue to document this old feature for several reasons:

  1. it does not work properlly (as you saw)
  2. It is PS only: PDF and SVG driver (the 2 others vector graphics ouput formats) don’ t support it
  3. There is an other way to do it via gPad->Divide().

Of course your case is a bit different because you have two canvases and therefore the gPad->Divide() recipe is not really helpful. Rene’s solution is good seems to me.

I can check why it does not work but we should keep in mind that this cannot not work with PDF… as PDF is now slowly replacing PS should we continue in that direction ?