[ROOT] multiple canvases on a ps file

From: Stilianos Kesisoglou (kesisogl@fnal.gov)
Date: Wed Mar 03 2004 - 09:51:59 MET


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.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET