I need to use rc('text', usetex=True)
in one of my plots, and I noticed that it changes the fonts that are used in the figure.
Before:
from matplotlib import rc
import matplotlib.pyplot as plt
rc('font', **{'family': 'monospace', 'monospace': 'Deja Vu Sans Mono', 'size': 25})
rc('text', usetex=False)
plt.clf()
x = [0,1,2]
y = [1,1,1]
plt.plot(x,y)
plt.ylabel(r"This is $y=1$", size=25)
plt.xlabel(r"This is x", size=25)
plt.show()
...
rc('text', usetex=True)
...
I tried working with the 'mathtext.*'
rc properties but I could find the settings that can align these two outputs. Is there a catch?
As mentioned in the Text rendering with LaTeX doc, "only a small number of font families are supported".
I'll let you check the available font families but for the monospace
family, only Computer Modern Typewriter and Courier are supported.