phollox
phollox

Reputation: 365

Insert an eps image within gnuplot?

I want to plot some data with gnuplot, but instead of using a regular key (or legend), I want to add images related to the source of the data. As an example, imagine that I'm plotting some data of iOS vs Android, and I want to add the logos instead of the names to the key. This plot would then included into a LaTeX document. My script looks similar to this.

#!/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 " "

The last two lines are the only entries with titles (empty), just to add something into the key, and the logos would be positioned close to them, to identify the series. The actual values on the script (origin, dx, dy, key position) would depend on the size of the logo images and the data plotted. With my images and data, I tweaked the values and it looks fine.

The thing is that I have an SVG image with my logos. From it I can create a vectorial EPS instead of a raster PNG. Is there any way where I can import an EPS image within gnuplot, without manually editing neither the EPS code nor the .tex generated by gnuplot with the epslatex terminal?

Thanks

Upvotes: 2

Views: 6232

Answers (1)

andyras
andyras

Reputation: 15920

gnuplot is not an image manipulation program, but there are workarounds. There are ways to include raster graphics via multiplot. The method outlined in my second link (using the epslatex terminal) should work for .eps graphics as well.

Upvotes: 2

Related Questions