matplotlib相关

标注
text(xMid,yMid,txtString,fontsize,verticalalignment=va,horizontalalignment=ha)

其中xMid和yMid是要标注的文字的坐标位置,txtString是要标注的文字,fontsize是字体大小,va和ha指定对其方式。

箭头

ax.annotate('txtString',xy,xycoords,xytext,textcoords,va=,ha=,bbox,arrowprops=)

其中,txtString是要注释的内容,xy是箭头的起点位置,xycoords和textcoords可以用来指明 xy和 xytext所在的坐标系,有以下几个可选择的参数:

‘figure points’ 距离图形左下角的点数量
‘figure pixels’ 距离图形左下角的像素数量 
‘figure fraction’ 0,0 是图形左下角,1,1 是右上角 
‘axes points’ 距离轴域左下角的点数量
‘axes pixels’ 距离轴域左下角的像素数量
‘axes fraction’ 0,0 是轴域左下角,1,1 是右上角


然后va就是verticalalignment,ha就是horizontalalinment,可选择的有top,bottom,center或者left,right,center。

arrowprops就是箭头的样式,一般写成arrowprops=dict(arrowstyle="->",connectionstyle="arc3")



猜你喜欢

转载自blog.csdn.net/yumi_huang/article/details/78127409
今日推荐