Matplotlib can already use TeX by setting text.usetex: True to ~/.matplotlib/matplotlibrc . Then you can simply use TeX in all displayed lines, e.g.
ylabel(r"Temperature (K) [fixed $\beta=2$]")
(be sure to use $ , as in a regular streaming TeX!). r before the string means that no substitutions are performed; otherwise, you should avoid slashes as indicated.
More information on matplotlib .
Andrew Jaffe
source share