printing multipage postscript files
Petr Mikulik
mikulik at physics.muni.cz
Wed Jun 3 04:04:43 CDT 2009
In Octave 2.x, printing many drawings into one multipage postscript file
was very easy:
gset term post; gset out 'a.ps'
plot(1:10)
plot(2:20) # many plots from simulations, one plot per page
gset out; gset term x11
(Note that multipage pdf files or animated gifs were also possible using
gset term pdf or gset term gif animate.)
In Matlab, it is achieved in a more complicated way which requires "print"
command after each plot:
plot(1:10)
print a.ps -dps
plot(2:20)
print a.ps -dps -dappend
which actually needs to be written in this way if the same script generates
graphs for screen and/or printer:
print=1;
plot(1:10)
if (print) print a.ps -dps; endif
plot(2:20)
if (print) print a.ps -dps -dappend; endif
How to achieve this in Octave 3.x where gset is no longer possible?
Gnuplot does not support concatenation of output into one file.
It seems to me that the "-dappend" option could be easily implemented in
Octave this way (requires ghostcript and creation of two temporary files):
print a.ps -dps -dappend
=>
drawnow('/tmp/tmp1.ps')
gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=/tmp/tmp2.ps \
a.ps tmp1.ps -c quit
mv /tmp/tmp2.ps a.ps
If ghostscript is not found, then the last plot will overwrite the file,
i.e.
mv /tmp/tmp1.ps a.ps
On unixes, ghostscript is always called "gs", thus there will be no problem.
On Windows, these names can be rather different ("gswinc"?).
On Mac?
Could the "-dappend" functionality by added?
---
Petr Mikulik
More information about the Bug-octave
mailing list