matplotlib mathtext \frac is too small

For anyone stumbling on this and also not wanting to set "text.usetex" to True, matplotlib now supports the \dfrac macro (equivalent to \displaystyle\frac in LaTeX) to replace \frac since version 2.1


As you said, you can fix it by using \displaystyle:

$\displaystyle\frac{A}{B} = C$

In order to allow matplotlib to use latex for all text handling you have to define in your matplotlibrc the text.usetex variable as True:

text.usetex          : True

I made a little example to verify it and it is working well:

import matplotlib.pyplot as plt
plt.plot(range(200))
plt.text(100,50,r'$\displaystyle\frac{A}{B}=C$')

I am sorry but since I am new, I can not post any image.