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

How to add a pdf image to a gnuplot plot?

我有一张 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.90):xtic(1) title col fs pattern 3

pdf 文件存储在 image.pdf.

至少可以用 epslatex 终端。首先,对于我的示例,我将生成一个 pdf 文件,它是一个 gnuplot 生成的图形:

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

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

pdflatex plot1.tex

看起来像这样:

为了将其嵌入到 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

然后,再次 运行 pdflatex:

pdflatex plot2.tex

生成 plot2.pdf,如下所示:

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