问题
I would like to remove the italics font that appears when I use subscripts in labels. For example, the "Teff" in the x-label has "eff" in italics. I would like latex not render it in such a way. Generally, in latex this can be achieved with the \rm{} command. However, that does not work in matplotlib. Please help.
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = x
plt.plot(x,y,'ro')
plt.xlabel('Primary T$_{eff}$')
回答1:
I have encountered this problem many times and it can be solved with this trick
plt.xlabel(r'Primary T$_{\rm eff}$')
来源:https://stackoverflow.com/questions/19671659/remove-italics-in-latex-subscript-in-matplotlib