Python:解决Matplotlib保存图片显示不全问题

保存图片的时候设置参数bbox_inches = 'tight',如:

plt.savefig("Matplotlib/graph.png", bbox_inches = 'tight')

以下是bbox_inches参数介绍:

bbox_inches:  str or Bbox, default: rcParams["savefig.bbox"] (default: None)

Bounding box in inches: only the given portion of the figure is saved. If 'tight', try to figure out the tight bbox of the figure.

参考

posted @ 2022-05-19 11:20  orion-orion  阅读(699)  评论(0编辑  收藏  举报