python数学公式展示

参考Print latex-formula with python

from fontTools.ttLib import TTFont
import matplotlib.pyplot as plt
from fontTools.pens.boundsPen import BoundsPen
a = r'\frac{a}{b}'
ax=plt.subplot(111)
ax.text(0.1,0.8,r"$\int_a^b f(x)\mathrm{d}x$",fontsize=30,color="red")
ax.text(0.1,0.3,r"$\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}!$",fontsize=30)
plt.show()

python数学公式展示_第1张图片

你可能感兴趣的:(工具)