Matplotlib tight_layout() doesn't take into account figure suptitle

后端 未结 10 1598
既然无缘
既然无缘 2020-11-28 18:02

If I add a subtitle to my matplotlib figure it gets overlaid by the subplot\'s titles. Does anybody know how to easily take care of that? I tried the tight_layout()

10条回答
  •  我在风中等你
    2020-11-28 18:28

    You can adjust the subplot geometry in the very tight_layout call as follows:

    fig.tight_layout(rect=[0, 0.03, 1, 0.95])
    

    As it's stated in the documentation (https://matplotlib.org/users/tight_layout_guide.html):

    tight_layout() only considers ticklabels, axis labels, and titles. Thus, other artists may be clipped and also may overlap.

提交回复
热议问题