标记曲线上一点
plt.annotate(r'$3x+1=%s$'%y0,xy=(x0,y0),xycoords='data',xytext=(+30,-30),
textcoords='offset points',fontsize=16,arrowprops=dict(arrowstyle='->',
connectionstyle='arc3,rad=.2'))
r’
3
x
+
1
=
3x+1=%s
3x+1=’%y0 字符的内容
xy=(x0,y0),xycoords=‘data’ 确定要标记的点
xytext=(+30,-30),textcoords=‘offset points’ 字符偏移放置
arrowprops=dict(arrowstyle=’->’,connectionstyle=‘arc3,rad=.2’
设置箭头的角度和弧度以及格式
效果展示
图上的注释
plt.text(0.5,0.5,r’
y
o
u
a
r
e
m
u
you are mu
youaremu’,fontdict={‘size’:16,‘color’:‘r’})
0.5 0.5为字符的坐标,后边为字符,fontdict是字符的格式
效果如下