0
votes

I am trying out this example in Python 3.4.4 using Matplotlib version 1.5.1 on Windows 10:

import numpy as np
import matplotlib.pyplot as plt
t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2*np.pi*t)

plt.plot(t,s)
plt.title(r'$\alpha_i > \beta_i$', fontsize=20)
plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20)
plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$',
         fontsize=20)
plt.xlabel('time (s)')
plt.ylabel('volts (mV)')
plt.show()

(see http://matplotlib.org/users/mathtext.html). It produces the following result:

enter image description here

What should I do to produce the intended result (see below)?

enter image description here

1
Are you over-riding the default font (e.g. in your .matplotlibrc file, font.sans-serif)? It looks like the Greek/math characters are missing in the font that is being used. - Bart
It works. I assume as Bart that you have a default font problem ;) - Essex

1 Answers

0
votes

Well, it turned out that my site-packages\matplotlib\mpl-data\fonts directory was corrupted. So I downloaded https://github.com/matplotlib/matplotlib/archive/v1.5.1.zip and copied the fonts directory from there to my machine. I deleted the .matplotlib/fontList.py3k.cache in my user directory and then everything worked fine.