我有一个图表,其中包含许多子图。
fig = plt.figure(num=None, figsize=(26, 12), dpi=80, facecolor='w', edgecolor='k')
fig.canvas.set_window_title('Window Title')
# Returns the Axes instance
ax = fig.add_subplot(311)
ax2 = fig.add_subplot(312)
ax3 = fig.add_subplot(313)
我该如何给子图添加标题?
fig.suptitle
会向所有图形添加标题,而虽然ax.set_title()
存在,但后者不会向我的子图添加任何标题。
感谢您的帮助。
编辑:
更正了有关set_title()
的拼写错误。感谢Rutger Kassies。
ax.set_title('标题', fontsize=16)
。请注意,在这种情况下,将标题大小设置为所需的大小。 - Tobias P. G.ax2.text()
,因为ax2.title.set_y()
不知何故无法正常工作。给定4个相同大小的子图,如果我将每个子图的axis.title.set_y()
赋值为$0.9$,它仍然会将标题放在奇怪的位置,并且每个子图之间不匹配。 - Hitanshu Sachania