我有一个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
Run Code Online (Sandbox Code Playgroud)
并且pdf文件存储在image.pdf中.
至少可以通过epslatex终端来完成.首先,对于我的例子,我将生成一个pdf文件,这是一个gnuplot生成的数字:
set term epslatex standalone
set output "plot1.tex"
plot sin(x)
Run Code Online (Sandbox Code Playgroud)
现在,在gnuplot之外,我生成pdf文件(命名plot1.pdf):
pdflatex plot1.tex
Run Code Online (Sandbox Code Playgroud)
看起来像这样:

为了将它嵌入到gnuplot图中,我再次使用epslatex终端并嵌入plot1.pdf乳胶文档中的任何pdf文件,使用\includegraphics[]{}环境,使用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
Run Code Online (Sandbox Code Playgroud)
而且,再次运行pdflatex:
pdflatex plot2.tex
Run Code Online (Sandbox Code Playgroud)
生成plot2.pdf,看起来像这样:

通过更改位置,label您可以更改嵌入式pdf的位置; 通过改变width你可以改变,猜猜是什么,嵌入pdf的宽度.