Thank you Alan

I have successfully integrated your solution in to my program

At the end, in order to do it I had to build something similar to plssub so
it played out with plstick

As stacking was just fine, I just split the pipe in to plssub + plenv for
stacking and my grid builder / indexer + plstick

Thank you again for the in-depth explanation, the code example and the link
to the documentation, which I recognize I should've checked before
impulsively start coding :)

Have fun!

Xavier

On Sat, Feb 15, 2020 at 7:27 PM Alan W. Irwin <alan.w.irwin1...@gmail.com>
wrote:

> On 2020-02-14 15:01+0100 Xavier Cardil wrote:
>
> > Hi Alan:
> > Thank you for sharing your code !
>
> You are welcome.
>
> >
> > I have been trying to integrate this in to my current python program
> > without luck, as it's already pretty complex, so what I am doing now
> > My program creates custom "subplot" objects and passes them through a
> > "pipe" that first generates the window, then organizes the plots and
> > finally draws them
> > One of the critical parts of the procedure is using plenv, which uses
> > itself pladv and sets a basic viewport, as per the plplot documentation
> > As it's hard to implement this without an example, I am trying to
> implement
> > your solution on a regular plplot example first, but:
> >
> > I have some difficulty understanding your code, so I would really
> > appreciate if you can clear some doubts:
>
> I think you already understand the plstick documentation (see my
> response to your documentation questions below).  And actually, the
> code is pretty clear as well.  Aside from some scaling of characters
> and symbols (which I don't completely follow myself, but it works
> reasonably well), it is just a wrapper for plvpor but with a different
> argument list that is convenient to use when you are grouping plots close
> together on a single page.
>
> Please review
> <http://plplot.org/docbook-manual/plplot-html-5.15.0/viewport_window.html>
> to make sure you understand the distinctions between plotting surface,
> (sub-)page, and viewport, and the plwind and plbox calls that
> establish the window corresponding to the viewport and annotate the
> viewport.
>
> For example, you could make a 4 plots jammed together for a given page
> by
>
> plinit()
> pladv(0)
>
> # Upper left viewport on page
> plvpor(0., 0.5, 0.5, 1.0)
> plwind(...)
> ...
> plbox(...)
> ...
>
> # Lower left viewport on page
> plvpor(0., 0.5, 0.0, 0.5)
> plwind(...)
> ...
> plbox(...)
> ...
>
> # Upper right viewport on page
> plvpor(0.5, 1.0, 0.5, 1.0)
> plwind(...)
> ...
> plbox(...)
> ...
>
> # Lower right viewport on page
> plvpor(0.5, 1.0, 0.0, 0.5)
> plwind(...)
> ...
> plbox(...)
> ...
>
> But you can successively replace those plvpor calls by
>
> plstick(2,2,1,1, 0., 0., 0., 0.)
> plstick(2,2,2,1, 0., 0., 0., 0.)
> plstick(2,2,1,2, 0., 0., 0., 0.)
> plstick(2,2,2,2, 0., 0., 0., 0.)
>
> to achieve exactly the same results (aside from the character and symbol
> scaling that
> goes on inside plstick).  Note, those first 2 arguments specify the size
> of the
> matrix of potential viewports, and the 3rd and 4 arguments specify the
> matrix
> element corresponding to the single viewport established by the
> plvpor call within plstick.
>
> The fundamental advantages of plstick over plvpor is those third and
> fourth arguments makes it easy to keep track of which part of the
> viewport matrix you are attempting to use, and you don't have to worry
> about keeping track of all the divisions and offsets to specify a
> particular element of the matrix.  For example, to specify the (2, 3)
> viewport matrix element within a 3x7 matrix you just need to call
>
> plstick(3,7,2,3,....)
>
> Or you could call plvpor directly instead, but that case there would be a
> lot of
> arithmetic involved to generate the correct limits corresponding to
> that matrix element.
>
> Note plenv internally calls pladv, plvpor, plwind, and plbox with some
> simplifying assumptions so it should not be used for any situation
> that is complex in the slightest
> such as attempting to jam plot viewports (and corresponding
> windows) together on a single (sub-)page.  So instead of plenv you
> must (as in the example above) call pladv once per (sub-)page followed
> by groups of plvpor (or plstick), plwind, and plbox calls that jam the
> viewports (and corresponding windows) together.
>
> If you want to take a look at a more complex but real-world example of
> using plstick, see
> <
> https://sourceforge.net/p/freeeos/freeeos/ci/master/tree/www/eos_papers/coulomb/coulomb_adjust.py
> >.
> This is the updated version of the Python script that generated the
> plot I attached last time.  If you look at that plot, there are two
> columns and 3 rows for the viewport matrix that is used, but a
> complication is there is a gap between the two columns to leave room
> for the annotation of the right-most column.  But specifying such a
> gap (and the space above and below each column) is handled with ease using
> the plstick spacing parameters.
>
> >
> >
> >   - # Sets up a viewport such that xnum X ynum of them fit onto a # page.
> >      - I assume this sets the amount of plots that will fit in to a page
> X
> >      / Y distributed ?
>
> Yes.
>
>
> >   - Make the active viewport the one at column currentx and row #
> >   currenty, starting at the top left.
> >      - This sets where plots will start being drawn, starting at the top
> >      left ?
>
> Yes.
>
> So I have confirmed you understand the documentation of plstick, and you
> have access to general documentation of the relationships between
> page, viewport, and window and two examples to work with.  So I hope
> this information completely solves the issue for you.
>
> Alan
> __________________________
> Alan W. Irwin
>
> Programming affiliations with the FreeEOS equation-of-state
> implementation for stellar interiors (freeeos.sf.net); the Time
> Ephemerides project (timeephem.sf.net); PLplot scientific plotting
> software package (plplot.org); the libLASi project
> (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
> and the Linux Brochure Project (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to