On 2007-09-04 14:32-0400 Salazar, German P21322 wrote:
> Well, I am back, although I have now changed the topic title to "replot".
>
> Like I said before, my ultimate objective is to have a single ps document
> where, say, pages 1 and 3 are in landscape and page 2 in portrait; that, I
> can already do with a small script if I have the two original files, one with
> all pages in landscape and another with all pages in portrait...then, I can
> pick and choose what pages I want in the final document.
>
> Here is the thing:
> I have managed to plot in landscape (no surprise there, that is the default).
> I have managed to plot in portrait, for real; the one option that does it is
> command line argument -portrait, and not plsdiori.
> I have also managed to do both things above in a single run by opening two
> streams, one left alone (landscape) and another set to protrait. This way I
> end up with I what need.
>
> So, basically, I am done.
>
> The thing is that I see a couple of C examples with the plreplot() command
> and I thought that was a lot more elegant than having to open two streams at
> the begining, keep switching/plotting to both streams at all times, and
> closing both streams at the end. Just doing everything once and saving a copy
> of it at the end seems simpler, if I can change from landscape to portrait
> right before the replot...except that I couldn't get there, since plreplot()
> will not work for me from Fortran...curiously enough, there are two C
> examples that use plreplot() but none in Fortran...does this mean something,
> i.e., plreplot does not work from fortran?
>
> Here is the message:
>
> *** PLPLOT WARNING ***
> plreplot: plot buffer not available
I got this to work, but only under special circumstances for both the C and
Fortran 77 version of our examples.
Here is the fortran patch for example 1.
****************
--- x01f.f_original 2007-09-04 12:01:35.000000000 -0700
+++ x01f.f 2007-09-04 12:36:20.000000000 -0700
@@ -28,6 +28,7 @@
integer digmax
integer PL_PARSE_FULL
parameter(PL_PARSE_FULL = 1)
+ integer cur_strm, new_strm
C some fortran compilers demand typing of intrinsic lnblnk, and
C although this is not demanded on g77 it also works there.
integer lnblnk
@@ -72,6 +73,19 @@
call plot2()
call plot3()
+ ! Test whether can work with streams and plreplot from fortran.
+ call plgstrm(cur_strm)! /*get current stream */
+ call plmkstrm(new_strm)! /* create a new one */
+
+ call plsfnam("test_stream.ps")! /* file name */
+ call plsdev("psc")! /* device type */
+
+ call plcpstrm(cur_strm, 0)! /* copy old stream parameters to new stream
*/
+ call plreplot()! /* do the save by replaying the plot buffer */
+ call plend1()! /* finish the device */
+
+ call plsstrm(cur_strm)! /* return to previous stream */
+
C Don't forget to call PLEND to finish off!
call plend()
****************
Ordinarily, I would like to make this patch part of the fortran version of
example 1, but plMergeOpts (which allows parsing of extra command-line
options for any given application) is not part of the Fortran interface so
there is no easy way to parse the -save option for example 1 in fortran.
Instead, I have used a fixed name (test_stream.ps) here, which of course
would not be suitable in general. Nevertheless, this patch is a good test
that plgstrm, plmkstrm, plsfnam, plsdev, plcpstrm, and plreplot are all
implemented correctly in Fortran (77) to call the appropriate C library
routines with the appropriate arguments since I got identical results with
this patch to the equivalent C routine using the command-line option
"-save test_stream.ps"
Now a comment on the "special circumstances" referred to above.
If you run
./x01c -save test_stream.ps -dev <device>
with <device> set to either psc or xcairo you get the
*** PLPLOT WARNING ***
plreplot: plot buffer not available
warning referred to by German above. However, if you specify the xwin or tk
devices you do produce a good plot in test_stream.ps. I assume what is
going on is xwin and tk set up a plot buffer and the other devices do not.
Another issue for -dev xwin and -dev tk is that after they create a good
test_stream.ps file both the C and patched Fortran example 1 produces a
segfault.
German, obviously the current limitations of the plreplot capability are so
severe that it is not useful to your needs, but I thought I should make some
general comments about what is wrong in case some developers got moved to
deal with one of the following issues that came up from my investigation:
(1) Implement plmergeopts for fortran.
(2) plot buffer capability expanded to more devices
(3) Deal with the above segfault.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.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
__________________________
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Plplot-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-general