Matplotlib annotate注解的用法

Axes.annotate(s, xy, xytext=None, xycoords='data', textcoords=None,
				arrowprops=None, annotation_clip=None, **kwargs)

功能:在图形上给数据添加注解。详细信息参考:官方文档
参数说明
s: str,注释文本内容。
xy: (float,float), 箭头点所在的坐标位置。
xytext: (float,float),注释内容的坐标位置。
xycoords: str,被注释点的参考坐标系。默认使用表中数据的坐标系。部分可选值如下:

描述
‘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)

textcoords: str,注释文本的参考坐标系。默认与xycoords属性值相同。
color: str,设置注释文本的颜色。默认是黑色。可选值:‘b’, ‘g’, ‘r’, ‘c’, ‘m’, ‘y’, ‘k’, ‘w’。
fontsize: str or int,设置注释文本字体大小。可选值:‘xx–small’ ‘x-small’ ‘small’ ‘medium’ ‘large’ ‘x-large’ ‘xx-large’。
arrowprops:dict,设置指向箭头的参数,字典中key值有
①arrowstyle:设置箭头的样式,可选值:。
②connectionstyle:设置箭头的形状,为直线或者曲线,可选值:‘arc3’,‘arc’,‘angle’,‘angle3’,可以防止箭头被曲线内容遮挡。
③color:设置箭头颜色。
④lw:线条粗细。
bbox:dict,为注释文本添加边框。

参考资料:

  1. matplotlib可视化篇annotate(),text()–注释文本
  2. Matplotlib中的annotate(注解)的用法
  3. 自定义annotate的arrowstyle后,如何调整线条粗细及箭头大小
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值