4
$\begingroup$

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?

$\endgroup$
5
$\begingroup$

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.

| cite | improve this answer | |
$\endgroup$
3
$\begingroup$

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.