加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

python中matplotlib画图时出现白边的解决方案

(2018-08-25 15:58:50)

import matplotlib.pyplot as plt


fig = plt.gcf()
plt.imshow(context)
# ax.set_xticks([])
# ax.set_yticks([])
plt.axis('off')
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.gca().yaxis.set_major_locator(plt.NullLocator())
plt.subplots_adjust(top=1, bottom=0, right=1, left=0, hspace=0, wspace=0)
plt.margins(0, 0)
fig.savefig(save_den, format='png', transparent=True, dpi=300, pad_inches=0)
# plt.savefig(save_den, bbox_inches='tight', pad_inches=0) #
# plt.show()
plt.close(fig)



具体的可以参考以下网页:

https://blog.csdn.net/jifaley/article/details/79687000



0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有