【Matplotlib】 标注一些点

来源:互联网 发布:三国杀淘宝永久武将 编辑:程序博客网 时间:2024/06/11 02:56

【Matplotlib】 标注一些点

相关的文档:

  • Annotating axis

  • annotate() command

标注的代码如下:

...t = 2 * np.pi / 3plt.plot([t, t], [0, np.cos(t)], color='blue', linewidth=2.5, linestyle="--")plt.scatter([t, ], [np.cos(t), ], 50, color='blue')plt.annotate(r'$sin(\frac{2\pi}{3})=\frac{\sqrt{3}}{2}$', xy=(t, np.sin(t)), xycoords='data', xytext=(+10, +30), textcoords='offset points', fontsize=16, arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))plt.plot([t, t],[0, np.sin(t)], color='red', linewidth=2.5, linestyle="--")plt.scatter([t, ],[np.sin(t), ], 50, color='red')plt.annotate(r'$cos(\frac{2\pi}{3})=-\frac{1}{2}$', xy=(t, np.cos(t)), xycoords='data', xytext=(-90, -50), textcoords='offset points', fontsize=16, arrowprops=dict(arrowstyle="->", connectionstyle="arc3,rad=.2"))...
0 0