Reputation: 1197
I am having a weird problem with plotting several pictures. So I use the following Perl-script to call gnuplot:
#!/usr/bin/perl
use strict;
use warnings;
open(GP, "| gnuplot >>gnuplot.log 2>&1") or die "Error: $!\n";
print GP << "GNU_EOF";
set terminal pdf
set output 'test.pdf'
plot 'data.log' u 1:2
set terminal unknown
plot 'data.log' u 1:2
replot 'data.log' u 1:3
set terminal pdf
set output 'testOverall.pdf'
replot
GNU_EOF
close(GP);
I use terminal unknown
to draw several lines and after drawing the last one I define an output (and terminal) to actually write the pdf. This works but somehow this plotting to unknown is disturbing the previous plot (in my example test.pdf) which has zero size.
It is always the picture before the plotting to unknown. My dirty workaround is to plot some dummy picture between test.pdf and testOverall.pdf and remove that zero sized dummy after calling gnuplot...
Why is this happening and how can I fix this behaviour?
Upvotes: 0
Views: 57
Reputation: 241928
You specify a terminal and output for the first image. You then change the terminal, but the output stays the same - therefore, the "several lines" go to the first pdf file. Try unsetting the output before drawing them.
Upvotes: 2