Ynj*_*jmh 14 python matplotlib
文件说
Axes.text(self, x, y, s, fontdict=None, withdash=已弃用的参数, **kwargs)
将文本添加到轴。
将文本 s 添加到数据坐标中位置x、y处的轴。
Axes.annotate(self, s, xy, *args, **kwargs)
用文本s注释点xy。
在最简单的形式中,文本放置在xy处。
或者,文本可以显示在另一个位置xytext。然后可以通过定义arrowprops添加从文本指向注释点xy的箭头。
两者相同Axes.text(),都Axes.annotate()可以向位置x、y添加文本。可以使用中的变换Axes.text()参数来更改坐标系,而它是中的xycoordsAxes.annotate()参数。
区别在于可以使用arrowprops参数Axes.annotate()绘制箭头,而不能。我看到的另一个区别是返回值。Axes.text()
所以我认为Axes.annotate()是 的超集Axes.text()。意思Axes.text()是没用吗?我什么时候应该使用Axes.text()而不是Axes.annotate()?
kur*_*sun 11
来自源代码文档:
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.
Run Code Online (Sandbox Code Playgroud)
另外,Annotation 是 Text 的子类。在这里,文本是更通用的显示文本的函数,注释是显示与图中的点(或位置)关联的文本的函数。(特别是有箭头指向的支持)
| 归档时间: |
|
| 查看次数: |
4842 次 |
| 最近记录: |