如何使用Gnuplot创建多页PDF文件? [英] How to create a multi-page PDF-file with Gnuplot?

查看:124
本文介绍了如何使用Gnuplot创建多页PDF文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac上通过 ruby​​-gnuplot 在Gnuplot上进行了很多绘制.如果我重新运行ruby脚本,则带有图的打开窗口的数量将增加一倍.如果我可以将所有这些图输出到在预览"中打开的PDF中,那么每次重新运行后该文件都会自动更新,而我无需费心关闭众多窗口.

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.

目前,我只能通过每个PDF文件一个图来实现此目的:

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

如何用Gnuplot的所有图形制作一个PDF?

How can I make a single PDF with all my figures by Gnuplot?

推荐答案

Hmm,至少在gnuplot上用于UN * x,Postscript和PDF的多页输出始终是默认设置-只要您不更改终端输入或重新分配输出文件,您绘制的所有内容都会在新页面上显示.

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.

即你这样做:

set terminal pdf
set output "multipageplot.pdf"
plot x, x*x
plot sin(x), cos(x)
set output ""

您最终在PDF文件中有两页,其中一页包含行/抛物线,另一页包含正弦/余弦.

and you end up with two pages in the PDF file, one containing line/parabola, the other sine/cosine.

阐明:重要的是按顺序发出所有plot命令,而不更改输出文件或更改终端类型. Gnuplot不会追加到现有的PDF文件中.

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.

这篇关于如何使用Gnuplot创建多页PDF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆