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

笑着哭i 提交于 2019-12-03 06:50:56
Lee Phillips

It is pretty simple. First you need to select a terminal that supports Unicode; then you can indeed paste your Unicode characters in directly. The old pdf terminal does not support Unicode, as you've found out, but the more recent pdfcairo does. You say it messes up your graphs, but how? I've found that it produces the same result, but with better quality (smoother lines, antialiasing, and Unicode!).

Everyone has a different set of terminals installed. Other terminals that might support Unicode on your system are pngcairo and svg. The latter is a vector format, like pdf. If you need pdf as a final file and pdfcairo is not working for you, use something else that can handle Unicode and convert the file. The LaTeX solution is ultimately the best if you want excellent labels and mathematical adornments, but to control the output you will need to get good at LaTeX.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!