Thanks for such a complete report.
I guess there are too many tricks to make plreplot work from =
Fortran...tricks that will eventually trip somebody over at some point; =
not to mention that, like I said before, I am going =
multi-platform...Solaris, Linux, Windows...so the xwin thing may not fly =
to good there. Also, I mentioned earlier that we couldn't make the =
plplot installation befriend Active State's tcl installation, which =
leaves tk out of the picture, too. I was already refered to some =
instructions, but I have no re-visited that link.
I will stick with dual streams, since it works without any tricks.
From: Alan W. Irwin [mailto:irwin@...
Sent: Tuesday, September 04, 2007 4:15 PM
To: Salazar, German P21322
Subject: Re: [Plplot-general] replot: buffer not available (thread =
started as "post processing with plrender")
On 2007-09-04 14:32-0400 Salazar, German P21322 wrote:
> Well, I am back, although I have now changed the topic title to =
> 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 =
> Here is the thing:
> I have managed to plot in landscape (no surprise there, that is the =
> 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 =
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 @@
parameter(PL_PARSE_FULL =3D 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.
@@ -72,6 +73,19 @@
+ ! 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 */=20
+ call plsfnam("test_stream.ps")! /* file name */
+ call plsdev("psc")! /* device type */
+ call plcpstrm(cur_strm, 0)! /* copy old stream parameters to new =
+ 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!
Ordinarily, I would like to make this patch part of the fortran version =
example 1, but plMergeOpts (which allows parsing of extra command-line
options for any given application) is not part of the Fortran interface =
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 =
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 =
this patch to the equivalent C routine using the command-line option
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 =
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 =
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
German, obviously the current limitations of the plreplot capability are =
severe that it is not useful to your needs, but I thought I should make =
general comments about what is wrong in case some developers got moved =
deal with one of the following issues that came up from my =
(1) Implement plmergeopts for fortran.
(2) plot buffer capability expanded to more devices
(3) Deal with the above segfault.
Alan W. Irwin
Astronomical research affiliation with Department of Physics and =
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state =
for stellar interiors (freeeos.sf.net); PLplot scientific plotting =
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads =
Linux Links project (loll.sf.net); and the Linux Brochure Project