简体   繁体   English

matplotlib中的图文字

[英]Figure text in matplotlib

I'm plotting quite simple with 我正在用

plt.plot(a,b)
plt.grid()
plt.show()

But I need a figure text. 但是我需要一个图文。 I know I can use text(x, y, my_text) but I don't always know which combinations of x and y are visible in the plot due to different plot values. 我知道我可以使用text(x, y, my_text)但由于绘制值不同text(x, y, my_text)我并不总是知道xy哪些组合在图中可见。

Can I instead place the text below the plot? 我可以将文字放在图表下方吗? I guess it's something like 我想这有点像

fig = plt.figure()
fig.text(0,0,my_text)
fig.plot(a,b)

(x, y) combination follow the next rules for figure coordinate system: (x,y)组合遵循图形坐标系的以下规则:

  • (0, 0) is bottom left of the figure. (0,0)在图的左下方。
  • (1, 1) is top right of the figure. (1,1)是该图的右上方。

This is independent of the plot. 这与情节无关。 You also can use axes coordinate and user data coordinate ( Transformations tutorial ). 您还可以使用轴坐标和用户数据坐标(“ 转换”教程 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM