user393267
user393267

Reputation:

Gnuplot: is there a way to add small gif icon on the plot?

I am looking for a way to add small icons on the plot, like OK or KO symbols, flags, arrows and such.

So far I've seen an example where you can add a background image, but nothing that actually allow me to set a point on the plot, like I could do with a label, and apply there an icon.

Is there a way to do so?

Upvotes: 4

Views: 2594

Answers (1)

Miguel
Miguel

Reputation: 7627

Call me obsessive but as usual this can be done with the epslatex terminal, embedding the image using a set label statement as you would do in regular latex. If your image is so-icon.png, then within gnuplot do:

set terminal epslatex standalone header "\\usepackage{graphicx}"
set output "plot.tex"
set label at screen 0.5,0.5 '\includegraphics{so-icon.png}'
plot sin(x)

And now run pdflatex

pdflatex plot.tex

Your output will be named plot.pdf and look like this:

enter image description here

Change the positioning of the label (help set label for more info) to wherever you want. You can also use the formatting options of \includegraphics{}, for example \includegraphics[width=2cm]{} for a 2cm wide version of your image (sorry, I don't do inches!).

Note that if you want to embed PNG, JPEG, GIF, PDF and so on, the pdflatex command is required, you cannot use regular latex for those.

Upvotes: 6

Related Questions