数码资讯
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.
参考
- [1] https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.savefig.html
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。