1.设置画图尺寸
plt.figure(figsize=(10, 5))
参考网址:/article/140719.htm
2. 去除plt画图四周的空白区域
2.1 方法一
实验后发现此方法会将坐标轴去掉。
plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.subplots_adjust(top=1,bottom=0,left=0,right=1,hspace=0,wspace=0)
参考网址:/xull88619814/article/details/82052894
2.2 方法二
实验后发现此方法不错。
plt.savefig('hah.png',bbox_inches='tight',dpi=fig.dpi,pad_inches=0.0)
参考网址:/cuotiaowei2543/article/details/83623655
还有一参考网址未验证:/raby_gyl/article/details/80337550
如果觉得《【编程语言之Python】之plt画图尺寸 去白边》对你有帮助,请点赞、收藏,并留下你的观点哦!