Latex together with matplotlib!

Sometimes you need to label your plot with math expression or Greek letters and ASCII is not enough.
Everything you need is to add to your script

from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
## for Palatino and other serif fonts use:
#rc('font',**{'family':'serif','serif':['Palatino']))
rc('text', usetex=True)

and write you text label like

label = r'theoretical $f(nu)$')
comments powered by Disqus