In MATLAB, if you type "\alpha" in an axis label it will render a 'plain-text' Greek character alpha, without the need for Latex. I hoping to do the same with Matplotlib's Pyplot.
Following How to use unicode symbols in matplotlib?, I've tried the following:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
if __name__ == "__main__":
plt.figure()
prop = FontProperties()
prop.set_file('STIXGeneral.ttf')
plt.xlabel(u"\u2736", fontproperties=prop)
plt.show()
x = np.linspace(-1,1,21)
plt.figure()
plt.plot(x,x)
plt.xlabel(u"\u03b1") # Attempt at creating an axis label with a Unicode alpha
# plt.xlabel(r'$\alpha$') # I'm aware that Latex is possible
plt.show()
However, I get an error message with ends with
IOError: [Errno 2] No such file or directory: 'STIXGeneral.ttf'
If I omit lines 3-10, I don't get an error message but the plot shows a square instead of a Greek letter alpha:
Is it possible to do this with Matplotlib? (I'm aware of the possibility to display Latex, but would prefer a 'plain text' option).