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后,如何调整线条粗细及箭头大小

Original: https://blog.csdn.net/p_memory/article/details/123890965
Author: jolando
Title: Matplotlib annotate注解的用法

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/768906/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球