Matplotlib可视化(二十)-- Tex公式

matplotlib自带mathtex引擎,不需要安装TeX系统
$作为开始和结束符,如'$ y = x**2 $' 

具体的希腊字母等可以去官网查看

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xlim([1, 7])
ax.set_ylim([1, 5])

ax.text(2, 4, r"$\alpha_i \beta_j \pi \lambda \omega $", size = 15)
ax.text(4, 4, r"$ \sin(0) = \cos(\frac{\pi}{2}) $", size = 15)
ax.text(2, 2, r"$ \lim_{x \rightarrow y} \frac{1}{x^3}$", size = 15)
ax.text(4, 2, r"$ \sqrt[4]{x} = \sqrt[2]{y} $", size = 15)
plt.show()

猜你喜欢

转载自blog.csdn.net/qq_42007339/article/details/104667452