On Sat, Sep 27, 2008 at 11:26:40PM -0400, Hezekiah M. Carty wrote:
> On Thu, Sep 25, 2008 at 10:05 AM, Davide Cesari <[EMAIL PROTECTED]> wrote:
> >        I would like to repeatedly enable/disable viewport clipping while
> > plotting, in order to draw lines, symbols, etc. in a legend outside the
> > plot, while retaining clipping when data is plotted. Is there a simple
> > way to do this in plplot, or is clipping-disable in the TODO list?
> >        Up to now i found a suboptimal solution (see fortran subroutine 
> > further
> > in text) by calling plgvpd/plgvpw to get viewport/window settings,
> > setting viewport to [0.,1.],[0.,1.] and enlarging correspondingly the
> > plotting window, then switching back to the initial settings when
> > desired. However in this way, after a disable/enable cycle, the plotting
> > window is not the same as before because the values obtained by plgwpd
> > are not exactly the one previously passed to plwind, a little correction
> > of 1.e-5 is made in the plwind code. Maybe adding a function similar to
> > the one I propose in the C api (with exact window settings) could be a
> > simple approach!? I could try provide a patch if this may help.
> 
> While I do not have a better method to propose at this time, I have
> faced the same plgvpw offset issue.  This 1.0e-5 offset seems to be an
> intentional adjustment - see plwind.c, starting at line 56:
> 
> --- FROM plwind.c, STARTING AT LINE 56 ---
>     dx = (xmax - xmin) * 1.0e-5;
>     dy = (ymax - ymin) * 1.0e-5;
> 
> /* The true plot window is made slightly larger than requested so that */
> /* the end limits will be on the graph  */
> 
>     plsc->vpwxmi = xmin - dx;
>     plsc->vpwxma = xmax + dx;
>     plsc->vpwymi = ymin - dy;
>     plsc->vpwyma = ymax + dy;
> --- END OF plwind.c PASTE ---
> 
> plsc->pvpw* are the values returned by plgvpw.  The simplest immediate
> solution would be to invert the above viewport adjustments to retrieve
> the original viewport dimensions.
> 
> For the PLplot core developers - would it be an acceptable change to
> have plgvpw return the proper xmin, xmax, ymin, ymax values rather
> than these adjusted values?  It would probably be less surprising for
> a user than the current function return values.  It is a change from
> how the function has worked in the past but I think it may be a
> worthwhile one.
> 
> If this is an acceptable change I would be happy to supply a patch to
> implement this. Another option would be to create a new function which
> returns the properly transformed plot limits.

Hez, 

In my view your proposal to reverse the adjustment for plgvpw makes
sense. The user would expect to get back the values they put in. A
patch to correct this would be acceptable to me at least as a temporary
fix.

Adding and removing this small adjustment leads to the possibility of 
rounding errors, so in the long term a better way might have to be
sought. The adjustment itself seems a bit of a fudge and there might
well be a better way of handling the edges of the viewport to ensure the
end limits do appear on the graph. This won't actually be required for
all applications of the viewport anyway, only if the viewport has axis
tics on it. This might need thinking about further.

I suggest further followup goes to plplot-devel as this is a development
issue.

Cheers

Andrew

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to