Python-Matplotlib 20 Tex公式

Python-Matplotlib 20 Tex公式

1 概念
  matplotlib自带的mathtext引擎,不需要安装TeX系统  
  $作为开始和结束符,如"$y=x+x $"

EG1 

import numpy as np
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 eta_j pi lambda omega $' , size=15)

ax.text(4,4, r'$ sin(0) = cost (frac {pi} {2}) $' , size=15)

ax.text(2,2 , r'$ lim_{x 
ightarrow y} frac{1} {x^3} $', size=15)

ax.text(4,2 , r'$ sqrt[4] {x} = sqrt {y} $', size=15)
plt.show()

  

原文地址:https://www.cnblogs.com/zsr0401/p/6428509.html