如何在Matplotlib中扩展图形底部的边距? [英] How do I extend the margin at the bottom of a figure in Matplotlib?

查看:53
本文介绍了如何在Matplotlib中扩展图形底部的边距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下屏幕截图显示了我的x轴.

The following screenshot shows my x-axis.

我添加了一些标签,并将它们旋转了90度,以便更好地阅读它们.但是,pyplot将底部截断,使得我无法完全读取标签.如何扩展下边距以查看完整的标签?

I added some labels and rotated them by 90 degrees in order to better read them. However, pyplot truncates the bottom such that I'm not able to completely read the labels. How do I extend the bottom margin in order to see the complete labels?

推荐答案

两种追溯方式:

fig, ax = plt.subplots()
# ...
fig.tight_layout()

fig.subplots_adjust(bottom=0.2) # or whatever

这是一个 subplots_adjust 示例: http://matplotlib.org/examples/pylab_examples/subplots_adjust.html

(但我更喜欢 tight_layout )

这篇关于如何在Matplotlib中扩展图形底部的边距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆