# Can gnuplot's PNG terminal use superscripts and subscipts?

I know that gnuplot's epslatex terminal can display superscipts and subscripts in titles and label axes. Is this also possible when using gnuplot's png terminal?

If so, how does one do this?

You can't just use TeX syntax unless you are using the TiKZ, epslatex, or another terminal that uses LaTeX to process the labels. You can get some fairly crude math layout, including superscripts and subscripts, by using the enhanced text option to many of gnuplot's terminals, including, sometimes, png. But you will have to use the gnuplot enhanced text syntax, which is unrelated to (La)TeX syntax. Fortunately, some of the syntax happens to coincide, including the basic use of superscripts and subscripts. On my system enhanced text works with the pngcairo terminal but not plain png. If you don't have that, you can try others, such as svg. I have plenty of examples of using both LaTeX and enhanced text in my new book.

It is possible to use LaTeX syntax for super- and subscripts in axes labels and titles when the terminal is set to png.

To to this, set the terminal with

set term png enhanced font "/full/path/to/font"


and then plot normally.

If the font part isn't included, you may get this error message:

gdImageStringFT: Could not find/open font


This means gnuplot can't find the plots on your system. On linux, fonts are generally located in /usr/share/fonts.

• I don't think that the font part is necessary. – Azrael3000 Mar 20 '12 at 11:56
• If I don't include it on my system, any label which would otherwise be $\LaTeX$ed is just omitted. – Dan Mar 20 '12 at 17:38
• Okay, seems to be system dependent then. – Azrael3000 Mar 20 '12 at 17:40