matplotlib保存图片去除白边

plt.savefig('a.jpg', bbox_inches='tight', pad_inches=-0.1, dpi=1000)

主要就两个参数:bbox_inchespad_inchespad_inches设置为负可能导致缩小xlabels和ylabels显示不全;dpi越大图像越清晰。

posted @ 2022-05-17 14:28  Js2Hou  阅读(1012)  评论(0编辑  收藏  举报