Dear plplot subscribers,
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.
Thank you for your help and best regards, Davide
SUBROUTINE clip_on_off()
USE plplot
IMPLICIT NONE
REAL(kind=plflt) :: nxmin, nxmax, nymin, nymax, &
wxmin, wxmax, wymin, wymax
REAL(kind=plflt), SAVE :: snxmin, snxmax, snymin, snymax, &
swxmin, swxmax, swymin, swymax
LOGICAL, SAVE :: clip_status = .TRUE.
IF (clip_status) THEN
! get and save the settings
CALL plgvpd (nxmin, nxmax, nymin, nymax)
CALL plgvpw (wxmin, wxmax, wymin, wymax)
snxmin = nxmin; snxmax = nxmax
snymin = nymin; snymax = nymax
swxmin = wxmin; swxmax = wxmax
swymin = wymin; swymax = wymax
! compute new "fullscreen" plotting window
wxmin = swxmin - (wxmax-wxmin)/(nxmax-nxmin)*(nxmin)
wxmax = swxmax + (wxmax-wxmin)/(nxmax-nxmin)*(1.0_plflt-nxmax)
wymin = swymin - (wymax-wymin)/(nymax-nymin)*(nymin)
wymax = swymax + (wymax-wymin)/(nymax-nymin)*(1.0_plflt-nymax)
! set viewport and plotting window to "fullscreen"
CALL plvpor(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt)
CALL plwind(wxmin, wxmax, wymin, wymax)
clip_status = .FALSE.
ELSE
! restore previous settings
CALL plvpor(snxmin, snxmax, snymin, snymax)
CALL plwind(swxmin, swxmax, swymin, swymax)
clip_status = .TRUE.
ENDIF
END SUBROUTINE clip_on_off
--
============================= Davide Cesari ============================
Servizio IdroMeteorologico ARPA Emilia Romagna
Area Modellistica Numerica e Radarmeteorologia
Phone/Fax: +39 051525926/+39 0516497501
E-mail: [EMAIL PROTECTED]
Home page: http://www.webalice.it/o.drofa/davide/
Address: ARPA-SIM, Viale Silvani 6, 40122 Bologna, Italy
========================================================================
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general