I'm trying to get a simple greek letter mu to display in roman font in a saved figure with matplotlib. I have tried two methods:
plt.xlabel(u'Wavelength (\u03bc m)')
This method works fine when I do a show()
, but when I try to use savefig()
, the mu character shows as a rectangle when saved as a .png. If I save as a .pdf, the symbol is missing entirely.
plt.xlabel(r'Wavelength ($\mathrm{\mu}$m)')
This method renders a greek letter with both show()
and savefig()
, but the character is still in italics in each case, despite requesting a roman font.
What's the trick?