如何将pdf图像添加到gnuplot图?

时间:2015-02-02 16:28:49

标签: gnuplot

我有一个PDF格式的图像,我想添加到现有的gnuplot图中。

我目前的代码如下:

set terminal postscript eps enhanced color solid font "Nimbus Roman No9 L" 35
set output '|epstopdf --filter > Patterns.pdf'
set size 1.8,1.8
set style data histogram
set style histogram cluster gap 1
plot 'Patterns.dat' using ($2/2.90):xtic(1) title col fs pattern 3

并且pdf文件存储在image.pdf中。

1 个答案:

答案 0 :(得分:5)

至少可以使用epslatex终端来完成。首先,对于我的例子,我将生成一个pdf文件,这是一个gnuplot生成的数字:

set term epslatex standalone
set output "plot1.tex"
plot sin(x)

现在,在gnuplot之外,我生成了pdf文件(名为plot1.pdf):

pdflatex plot1.tex

看起来像这样:

enter image description here

要将其嵌入到gnuplot图表中,我再次使用epslatex终端并嵌入plot1.pdf,就像使用\includegraphics[]{}环境中乳胶文档中的任何pdf文件一样,使用gnuplot label

set term epslatex standalone
set output "plot2.tex"
set label at graph 0.75,0.25 '\includegraphics[width=2cm]{plot1.pdf}'
plot x

并再次运行pdflatex

pdflatex plot2.tex
生成plot2.pdf

,如下所示:

enter image description here

通过更改label的位置,您可以更改嵌入式pdf的位置;通过更改width您可以更改,猜猜嵌入式pdf的宽度。

相关问题