【发布时间】:2014-12-10 13:25:09
【问题描述】:
我想用 gnuplot 绘制一些数据,但我想添加与数据源相关的图像,而不是使用常规键(或图例)。例如,假设我正在绘制 iOS 与 Android 的一些数据,并且我想将徽标而不是名称添加到键中。该图随后将包含在 LaTeX 文档中。我的脚本与此类似。
#!/usr/bin/gnuplot -persist
set terminal epslatex size 6in,4in color dashed
set output 'apple-vs-android.tex'
set key bottom spacing 2 maxrows 1 width 8 at first 2000,175
set tics out mirror
unset x2tics
unset y2tics
set xlabel 'Year'
set ylabel 'Users'
plot "apple.dat" u 1:2 w l lt 1 lc 0 notitle smooth csplines,\
"android.dat" u 1:2 w lp pt 12 lt 3 lc 0 notitle smooth csplines,\
"apple.dat" u 1:2 w p pt 2 lc 0 notitle,\
"android.dat" u 1:2 w p pt 12 lc 0 notitle,\
"apple-logo.png" binary filetype=png origin=(1960, 165) dx=1./10 dy=1./220000 with rgbimage notitle,\
"android-logo.png" binary filetype=png origin=(1995, 165) dx=1./10 dy=1./220000 with rgbimage notitle,\
-10 w lp pt 2 lt 1 lc 0 t " ",\
-10 w lp pt 12 lt 3 lc 0 t " "
最后两行是唯一带有标题的条目(空),只是为了在键中添加一些内容,并且徽标将位于靠近它们的位置,以识别系列。脚本上的实际值(原点、dx、dy、关键位置)将取决于徽标图像的大小和绘制的数据。使用我的图像和数据,我调整了值,看起来不错。
问题是我有一个带有我的徽标的 SVG 图像。从中我可以创建矢量 EPS 而不是光栅 PNG。有什么方法可以在 gnuplot 中导入 EPS 图像,而无需手动编辑 EPS 代码和 gnuplot 使用 epslatex 终端生成的 .tex?
谢谢
【问题讨论】:
-
感谢您的评论。
\includegraphics标签很聪明,也可以用于矢量图 -
该方法与
epslatex一起使用几乎是唯一的方法(除了使用其他与TeX 相关的终端之外)使用gnuplot 包含矢量图形而无需后处理。