Tutorial by Examples

TeX formulae can be inserted in the plot using the rc function import matplotlib.pyplot as plt plt.rc(usetex = True) or accessing the rcParams: import matplotlib.pyplot as plt params = {'tex.usetex': True} plt.rcParams.update(params) TeX uses the backslash \ for commands and symbols, whic...
In order to include plots created with matplotlib in TeX documents, they should be saved as pdf or eps files. In this way, any text in the plot (including TeX formulae) is rendered as text in the final document. import matplotlib.pyplot as plt plt.rc(usetex=True) x = range(0, 10) y = [t**2 for t...

Page 1 of 1