Matplotlib库 标注在工作有很大作用:
Annotate的构造函数为 :Annotation(s, xy, xytext=None, xycoords=‘data’, textcoords=None, arrowprops=None, annotation_clip=None, **kwargs) 用于绘制连接图上两点的箭头。
关键参数:
s 为注释文本内容
xy 为被注释的坐标点,二维元组形如(x,y)
xytext 为注释文本的坐标点,也是二维元组,默认与xy相同
xycoords为被注释点的坐标系属性(通常xycoords值为’data’,即以被注释的坐标点xy为参考)
Value Description
================= =============================================
'figure points' Points from the lower left of the figure
'figure pixels' Pixels from the lower left of the figure
'figure fraction' Fraction of figure from lower left
'axes points' Points from lower left corner of axes
'axes pixels' Pixels from lower left corner of axes
'axes fraction' Fraction of axes from lower left
'data' Use the coordinate system of the object being
annotated (default)
'polar' *(theta, r)* if not native 'data' coordinates
================= =============================================
textcoords 设置注释文本的坐标系属性(textcoords 选择为相对于被注释点xy的偏移量,‘offset points’或者’offset pixels’)
arrowprops