我有一个包含许多子图的图.
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)
Run Code Online (Sandbox Code Playgroud)
如何向子图添加标题?
fig.suptitle为所有图形添加标题,虽然ax.set_title()存在,但后者不会为我的子图添加任何标题.
谢谢您的帮助.
编辑:纠正错误set_title().谢谢Rutger Kassies
我开始使用matplot并管理一些基本情节,但现在我发现很难发现如何做我现在需要的东西:(
我的实际问题是如何将一个全局标题和全局图例放在带有子图的图形上.
我正在做2x3子图,我有很多不同颜色的图(大约200个).为了区分(大多数)我写的东西
def style(i, total):
return dict(color=jet(i/total),
linestyle=["-", "--", "-.", ":"][i%4],
marker=["+", "*", "1", "2", "3", "4", "s"][i%7])
fig=plt.figure()
p0=fig.add_subplot(321)
for i, y in enumerate(data):
p0.plot(x, trans0(y), "-", label=i, **style(i, total))
# and more subplots with other transN functions
Run Code Online (Sandbox Code Playgroud)
(对此有何看法?:))每个子图都有相同的样式功能.
现在我正试图获得所有子图的全局标题,以及解释所有样式的全球传奇.此外,我需要使字体很小,以适应那里的所有200种样式(我不需要完全独特的样式,但至少有一些尝试)
有人可以帮我解决这个任务吗?