如何移动子地块的标题,使第二个轴不在标题的顶部,而是在标题的下方?这是它的样子
下面是相关的代码片段:
# fig is a subplotAxes object
fig.set_ylabel('Altitude (km)')
fig.set_xlabel('Time')
fig.get_xaxis().set_major_formatter(mpl.dates.DateFormatter('%H:%M:%S'))
cbar_label = 'Total Attenuated Backscatter 532nm (km$^{-1}$ sr$^{-1}$)'
cbar = pfig.colorbar(im)
cbar.set_label(cbar_label)
# create second axis
ax2 = fig.twiny()
ax2.set_label('Latitude')
ax2.set_xlim(latitude[0], latitude[-1])
# set title, but title is overwritten
fig.set_title("Averaged 532 nm Total Attenuated Backscatter")
我不知道这是否是我的身材大小或一个简单的格式错误的原因。我不想扩大我的图形大小,因为这个图位于Tkinter窗口内
试试
fig.suptitle("Averaged 532 nm Total Attenuated Backscatter")
这个解决方案比我想象的要简单得多,我觉得自己很笨。我所需要做的就是在标题的末尾添加一个
\n
由于您的标题适用于整个人物,而不仅仅是子情节,@György Solymosi的答案可能是正确的(而不是添加一行新词,这是一种攻击)
或者,您可以将标题文本重新定位到您想要的位置,例如,将其提高5%:
相关问题 更多 >
编程相关推荐