views:

16

answers:

2

I have the following axis labels and legend.

plt.ylabel("ratio_2")
plt.xlabel("n_1")
plt.legend(('alpha_1','alpha_2' ), loc = 'best',shadow = True)   
+1  A: 

The easiest way I know is to enable TeX mode for matplotlib,

from http://www.scipy.org/Cookbook/Matplotlib/UsingTex:

from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
Andrew Walker
What this does is it runs all your text through TeX, writing various files on the way. Matplotlib has its own TeX-like engine that is faster - just put dollar signs around the formula.
Jouni K. Seppänen
+1  A: 

Put dollar signs around the formula: plt.xlabel("$n_1$")

Jouni K. Seppänen