Hi,
The normal way to use this feature is without divided pad like in this
example:
{
//demonstrate a problem with many pictures per ps file
TCanvas* canvas = new TCanvas("canvas");
TH1F* histo = new TH1F("histo","test 1",10,0.,10.);
histo->Fill(2.);
histo->Draw();
canvas->Print("plots.ps(","ps");
histo->Fill(4.);
histo->Draw();
canvas->Print("plots.ps","ps");
histo->Fill(6.);
histo->Draw();
canvas->Print("plots.ps","ps");
histo->Fill(8.);
histo->Draw();
canvas->Print("plots.ps)","ps");
}
Cheers, O.Couet
On Wed, 3 Mar 2004, Stilianos Kesisoglou wrote:
> Hi,
>
> I am kind of confused about how to place multiple canvases
> on the same ps file. It looks like there are some inconsistencies (?)
> depending the way that someone follows.
>
> The "inconsistencies" originate from the fact that when drawing, plotting,
> updating, dividing etc.. the canvas, there are implicit calls to methods
> of the postscript like NewPage(?) etc...
>
> Can we simply "decouple" the canvas drawing from the ps filling so that
> we can control them individually?
>
> For example the following case seems "clean" and easy but it doesn't
> produces what I would expect:
>
> myCanvas->Print("myPSFILE.ps[");
>
> for (.......)
> {
> myCanvas->Divide(2,1);
> ....
> ....
> myCanvas->cd(1);
> ....
> .... draw in pad 1 .....
> ....
> myCanvas->cd(2);
> ....
> .... draw in pad 2 .....
> ....
> myCanvas->Update();
>
> myCanvas->Print("myPSFILE.ps");
> }
>
> myCanvas->Print("myPSFILE.ps]");
>
> The above scenario produces all pages to be blank except the first.
> Even if the "suspicious" Update() is removed the initial Divide()
> creates a problem. It has to go outside the loop.
> But this removes me the ability to make a single page on the ps file
> with only one pad if I want to inside the loop.
>
>
> I can treat the whole thing in another way that allows me the above
> but then I am loosing simplicity. If the ps file was treated like this:
>
>
> TPostScript *ps = TPostScript ("myPSFILE.ps",111);
>
> for (.......)
> {
> ps->NewPage();
>
> myCanvas->Divide(2,1);
> ....
> ....
> myCanvas->cd(1);
> ....
> .... draw in pad 1 .....
> ....
> myCanvas->cd(2);
> ....
> .... draw in pad 2 .....
> ....
> myCanvas->Update();
>
> }
>
> ps->Close();
>
> now the Update() AND NewPage() are needed UNLESS there was only one pad
> in which case they are NOT needed. The second way allows me to change
> the canvas division with no problem.
>
> All of this mess comes from the fact that actions call implicitly some
> methods without me asking them.
>
> Is it possible to "decouple" the canvas drawing from the ps output?
>
> This way I can do whatever I want in my canvas and when I decide
> that I like it and that I am over with the drawing I can send the result
> to be stored as a page in the ps file.
>
> Thanks!
>
> Stelios.
>
--
Org: CERN - European Laboratory for Particle Physics.
Mail: 1211 Geneve 23 - Switzerland Mailbox: J25910
E-Mail: Olivier.Couet@cern.ch Phone: +41 22 7676522
WWW: http://cern.ch/Olivier.Couet/ Fax: +41 22 7677155
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET