Python 如何在matplotlib中的绘图之间放置文本
我有一个使用matplotlib的绘图网格,希望文本位于两个绘图之间。这是我的密码:Python 如何在matplotlib中的绘图之间放置文本,python,matplotlib,Python,Matplotlib,我有一个使用matplotlib的绘图网格,希望文本位于两个绘图之间。这是我的密码: import matplotlib.pyplot as plt fig, ax = plt.subplots(3,3, figsize = (14,8)) ax[0,0].set_title('(0,0)') ax[0,1].set_title('(0,1)') ax[0,2].set_title('(0,2)') ax[1,0].set_title('(1,0)') ax[1,1].set_title('(1
import matplotlib.pyplot as plt
fig, ax = plt.subplots(3,3, figsize = (14,8))
ax[0,0].set_title('(0,0)')
ax[0,1].set_title('(0,1)')
ax[0,2].set_title('(0,2)')
ax[1,0].set_title('(1,0)')
ax[1,1].set_title('(1,1)')
ax[1,2].set_title('(1,2)')
ax[2,0].set_title('(2,0)')
ax[2,1].set_title('(2,1)')
ax[2,2].set_title('(2,2)')
info = 'A = {}'.format(1)
ax[0,1].text(1.2,0.5,info)
fig.tight_layout()
plt.show()
它打印了这个:
我想要的是在图(0,1)和(0,2)之间有文本。有没有办法做到这一点?是的,您可以使用
您需要设置x和y值以对应要添加文本的绘图的右轴中间,并且可以使用垂直对齐
和水平对齐
将文本放置在所需位置
看
希望这有帮助