[英]How to add text to matplotlib plot from a figure object?
My code contains the following lines: 我的代码包含以下几行:
from matplotlib.figure import Figure
figure = Figure(figsize=(10, 5), dpi=dpi)
How can I add text to this 我该如何添加文字
Texts can be added from a axis object. 可以从轴对象添加文本。 So you may try this: 因此,您可以尝试以下操作:
from matplotlib.figure import Figure
figure = Figure(figsize=(10, 5), dpi=dpi)
ax = figure.add_axes((0.05, 0.05, 0.9, 0.9))
ax.text(0.5, 0.5, 'Text', ha='center')
More examples can see the document , and details of parameters here 更多示例可以查看该文档 ,以及此处的参数详细信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.