问题:
I have one figure which contains many subplots.我有一个包含许多子图的图形。
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)
How do I add titles to the subplots?如何为子图添加标题?
fig.suptitle
adds a title to all graphs and although ax.set_title()
exists, the latter does not add any title to my subplots. fig.suptitle
为所有图形添加了一个标题,虽然ax.set_title()
存在,但后者没有为我的子图添加任何标题。
Thank you for your help.感谢您的帮助。
Edit: Corrected typo about set_title()
.编辑:更正了有关set_title()
错字。 Thanks Rutger Kassies感谢 Rutger Kassies
解决方案:
参考一: https://stackoom.com/question/1hu3h参考二: How to add title to subplots in Matplotlib?