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
前一篇:word排版多个图片