圖片不清晰,需要指定dpi,
圖片保存大小問題,設置bbox_inches=‘tight’
(bbox_inches:可選bbox英寸。只保存圖形的給定部分。如果“緊”,試着找出數字的緊框。如果沒有,請使用savefig.bbox)
plt.savefig("data/temp.png",dpi=500,bbox_inches = 'tight')#解決圖片不清晰,不完整的問題
https://blog.csdn.net/qq_31648921/article/details/88560191
plt.colse()
保存圖像時去除圖像邊緣的空白區域
plt.axis('off') plt.gcf().set_size_inches(512 / 100, 512 / 100) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.subplots_adjust(top=1, bottom=0, right=0.93, left=0, hspace=0, wspace=0) plt.margins(0, 0) plt.savefig('image.png')
很多資料中都只是單純的用了subplots_adjusts()或者margins(),需要將兩個函數都用上才能完全地去除空白邊框。
https://blog.csdn.net/qq_24185239/article/details/90679614