Python Matplotlib annotate() 错误:LaTeX 表达式缺少封闭花括号
在给定的代码中,错误是在注释中的LaTeX表达式中缺少了一个封闭的花括号。正确的表达式应该是'$\sin(\frac{2\pi}{3})=\frac{\sqrt{3}}{2}$',其中除号后面有一个2。正确的代码应该是:
plt.annotate(r'$sin(\frac{2\pi}{3})=\frac{\sqrt{3}}{2}$',xy=(t,np.sin(t)),xytext=(10,30),fontsize=16,arrowprops=dict(arrowstyle='->',connectionstyle='arc3,rad=0.2'))
原文地址: https://www.cveoy.top/t/topic/pioB 著作权归作者所有。请勿转载和采集!