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 -- Hezekiah M. Carty Graduate Research Assistant University of Maryland Department of Atmospheric and Oceanic Science ------------------------------------------------------------------------- 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