When using matplotlib drawing to add a formula to a picture, it is generally necessary to use the text or annotate function, combined with latex grammar ' $...$ '.

For fractions, if you use \frac{}{} directly, the characters on the numerator denominator are small, as shown in the Green formula.

To solve this problem, we need to use the **\displaystyle**, that is, using the ' $\displaystyle ... $ ', as shown in the Blue formula in the effect. However, the prerequisite for using this is that the system is equipped with latex. (I use Protext, as: http://mirrors.ibiblio.org/CTAN/systems/windows/protext/do not miktex because the download package often fails, So simply install a more complete set of things. In addition to using Tex in the program, add the following code:

**mpl.rcparams[' Text.usetex ') = True**

Attached picture code:

xx = Linspace ( -3,3,100)

YY = exp (-xx**2)

Xlim (-4, 3)

Plot (Xx,yy, ' m ')

Text ( -3.5,0.80,r ' $y ={\rm exp}\left (-\alpha \left (\frac{x}{r}\right) ^2\right) $ ', color= ' G ')

Text ( -3.5,0.62,r ' $\displaystyle y={\rm exp}\left (-\alpha \left (\frac{x}{r}\right) ^2\right) $ ', color= ' B ')

When working with formulas in a Python drawing, solve the problem that the font of \frac{}{} is too small