【发布时间】:2020-10-29 09:16:01
【问题描述】:
我想完全将我的多行图例标题居中。
当标题跨越一行时,它是居中的。当它跨越多条线时,似乎最长的线居中,然后所有其他线都相对于最长的线左对齐。
我查看了matplotlib.font_manager.FontProperties 类,在该类中我看到我可以将标题加粗,但似乎没有任何居中选项。感谢任何建议!
fig, ax = plt.subplots()
ax.plot([0, 1, 2, 3], [4, 1, 2, 5], label='Very Long label A')
ax.plot([0, 1, 2, 3], [3, 5, 4, 1], label='Very Long label B')
leg = ax.legend()
leg.set_title('Legendary\nTitle', prop={'size': 12, 'weight':'bold'})
【问题讨论】:
标签: python matplotlib legend