文件上说
将文本添加到轴上。 在数据坐标中,将文本s添加到位置x,y的轴上。
用文本s注释xy点。 在最简单的形式中,文本放在xy。 可以选择将文本显示在另一个位置xytext中。然后,通过定义arrowprops,可以添加从文本指向注释点xy的箭头。
Axes.text()和Axes.annotate()都可以将文本添加到x,y的位置,使用Axes.text()中的转换参数可以改变坐标系,而在Axes.annotate()中则可以使用xycoords参数来改变坐标系。然而,Axes.annotate()可以使用arrowprops参数绘制箭头,而Axes.text()不能。
所以我认为Axes.annotate()是Axes.text()的超集。这是否意味着Axes.text()是无用的?什么时候应该使用Axes.text()而不是Axes.annotate()
发布于 2021-03-25 05:58:09
来自源代码文档:
class Annotation(Text, _AnnotationBase):
"""
An `.Annotation` is a `.Text` that can refer to a specific position *xy*.
Optionally an arrow pointing from the text to *xy* can be drawn.此外,注释子类文本。在这里,文本是显示文本的更一般的函数,注释是函数显示与图中某个点(或位置)相关联的文本。(特别是在箭头指向的支持下)
https://stackoverflow.com/questions/62086341
复制相似问题