gnuplot - pdf terminal - setting unicode character (solar mass symbol/odot)

jtlz2 picture jtlz2 · May 27, 2012 · Viewed 8k times · Source

I'm trying to set the LaTeX \odot symbol in the gnuplot (4.6.0) pdf terminal. What is the exact syntax for this?

The gnuplot FAQ gives some clues, but should I type {/Symbol \2299}, or {/utf8 \2299}, or some other variation on \, /, # etc.? Or should I do set encoding utf8? Pasting the symbol in directly does not seem to work.

Should I use pdf or pdfcairo for the terminal? The latter affects my plots in intolerable ways.

Answer

andyras picture andyras · May 27, 2012

Here is a way using the epslatex terminal. Run these commands in gnuplot or a gnuplot script:

set terminal epslatex standalone color
set output 'plot.tex'

set xlabel '$\odot$ is a \LaTeX symbol.'
plot sin(x)

Then you can run pdflatex on the resulting plot.tex, or latex followed by dvipdf. This works fine if you don't mind having LaTeX for the interpreter for all the text in your plot. If you want just the \odot symbol included I'm not sure how to do it.