我是matplotlib的新手,我试图将文本设置为图形中的某个点,但出现错误:
Traceback (most recent call last): File "main.py", line 239, in main() File "main.py", line 232, in main p.show_graphic_ortg_drtg() File "/home/josecarlos/Workspace/python/process/process.py", line 363, in show_graphic_ortg_drtg Axes.Axes.annotate(xy=(df[0:1]["ortg"], df[0:1]["drtg"]), s="Hola") TypeError: annotate() missing 1 required positional argument: 'self'
我的代码是:
import matplotlib.axes as Axes
Axes.Axes.annotate(xy=(df[0:1]["ortg"], df[0:1]["drtg"]), s="Message")
df是以前生成的熊猫数据帧。在
我做错什么了?我遵循了一些教程和文档,我没有发现错误。在
不能直接从类调用非静态方法。首先需要实例化Axis对象。在
有很多方法可以获得Axes实例。简单而紧凑的方法是:
不能直接从类导入它。在
简要说明:
示例(取自the documentation):
^{pr2}$参考号:https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axes.Axes.annotate.html
相关问题 更多 >
编程相关推荐