标题垂直移动 y
,但如果figheight
更改,则标题与x轴之间的距离/填充不是恒定的:
fig, axs = plt.subplots(1,1, figsize=(15,2.5*1.5))
axs.set_title("mytitle", fontsize=14, y=-0.2, ha='center')
当figheight增加时,它会移动:
我尝试了以下内容:
axs.set_title("我的标题", fontsize=14, va='bottom', ha='center')
没有重新定位(在顶部停留)和fontdict-form,无变化:
axs.set_title('我的标题', fontdict={'fontsize': 20, 'verticalalignment': 'bottom', 'horizontalalignment': 'center'})
编辑
标题只是我现在使用的文本,它是模块化的:
axs.text(0.5,1,'some_title', va='bottom', ha='center', transform=axs.transAxes, color='k', fontsize=15, bbox={'facecolor':'white', 'edgecolor':'white', 'alpha':1, 'pad':10})
请查看文本命令以获取更多信息。