On Mon, 23 Feb 2009, artur tarassow wrote:
I am really glad that you have incorporated the gnuplot command
within
the loop structure. But one thing still remains.
[ namely, the ability to save the plot "as an icon" ]
The actual reason why I am asking is that I do not know how to
handle the produced *.plt file. Actually I would like to produce
a *.eps file or whatever automatically...
The following script works on Linux; the system ("!") commands
would obviously have to be changed for Windows:
<script>
function make_eps (scalar i)
# reconstruct the plot name used by gretl
sprintf pltname, "gpttmp%02d.plt", i
# make a name for EPS output
sprintf epsname, "plot%02d.eps", i
# echo the relevant gnuplot cmds into a temp file
! echo "set term post eps" > tmp.plt
! echo "set output '@epsname'" >> tmp.plt
# and dump the content of gretl's plotfile
! cat @pltname >> tmp.plt
# run gnuplot to produce EPS
! gnuplot tmp.plt && rm tmp.plt
end function
open data9-7
list L = QNC INCOME PRICE UNEMP
loop foreach i L
gnuplot $i --time-series --with-lines
make_eps(i)
endloop
</script>
The script produces EPS files plot01.eps, ..., plot04.eps.
One thing on the "TODO" list is a modification of gretl's gnuplot
command so that you can do something like
gnuplot <specs> --output=foo.eps
The idea is that the "output" parameter would (a) give you control
over the naming of the file, and (b) allow you to specify the
type of file implicitly via the filename extension (.eps, .pdf,
.svg, .png, etc., for gnuplot-supported formats). You could still
use an extension of .plt or .gp to get a gnuplot command file
suitable for further editing.
Allin.