10.15 LaTeX and Pyxplot

The text command can straightforwardly be used to render simple one-line latex strings, but sometimes the need arises to place more substantial blocks of text onto a plot. For this purpose, it can be useful to use the latex parbox or minipage environments1. For example:

text r’$\backslash $parbox[t]{6cm}{$\backslash $setlength{$\backslash $parindent}{1cm} $\backslash $
$\backslash $noindent There once was a lady from Hyde, $\backslash $newline $\backslash $
Who ate a green apple and died, $\backslash $newline $\backslash $
$\backslash $indent While her lover lamented, $\backslash $newline $\backslash $
$\backslash $indent The apple fermented, $\backslash $newline $\backslash $
and made cider inside her inside.}’

\includegraphics{examples/eps/ex_text1}

If unusual mathematical symbols are required, for example those in the amsmath package, such a package can be loaded using the set preamble command. For example:

set preamble $\backslash $usepackage{marvosym}
text r"{$\backslash $Huge$\backslash $Dontwash$\backslash $ $\backslash $NoIroning$\backslash $ $\backslash $NoTumbler}$$\backslash $;$ Do not $\backslash $
wash, iron or tumble-dry this plot."

\includegraphics{examples/eps/ex_text2}

Footnotes

  1. Remember, any valid latex string can be passed to the text command and set label command.