I make a dozen of plots with Gnuplot on Mac via ruby-gnuplot. If I re-run my ruby script, then the number of open windows with the plots doubles. If I could just output all these plots in a PDF opened in Preview, then the file would be automatically updated after every re-run and I don't need to bother closing the numerous windows.
Currently I can achieve this only with one plot per PDF-file:
Gnuplot.open do |gp|
Gnuplot::Plot.new(gp) do |plot|
plot.arbitrary_lines << "set terminal pdf \n set output 'figures.pdf'"
# ...
end
end
How can I make a single PDF with all my figures by Gnuplot?
Hmm, at least on gnuplot for UN*x, multipage output for postscript and PDF always was the default - as long as you don't either change the terminal type nor reassign the output file, everything you plot ends up on a new page.
I.e. you do:
set terminal pdf
set output "multipageplot.pdf"
plot x, x*x
plot sin(x), cos(x)
set output ""
and you end up with two pages in the PDF file, one containing line/parabola, the other sine/cosine.
To clarify: The important thing is to issue all the plot
commands in sequence, without changing the output file nor changing the terminal type. Gnuplot won't append to an existing PDF file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With