在 colaboratory 上使用 plt.savefig 保存数字 [英] saving figures using plt.savefig on colaboratory
本文介绍了在 colaboratory 上使用 plt.savefig 保存数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 collaboratory(在线 jupyter 笔记本)我有以下代码我正在使用此函数绘制一些图形并希望在本地保存图形我该怎么做?
I am using collaboratory(online jupyter notebook) I have the following code i am plotting some graphs using this functions and want to save plots locally how can I do this ?
def make_plot_comparison(Xlabel,Ylabel,l1,l2,l1_title,l2_title,name):
plt.xlabel(Xlabel)
plt.ylabel(Ylabel)
plt.plot(l1,label=l1_title)
plt.plot(l2,label=l2_title)
plt.legend(loc='center right')
plt.title(name)
#plt.xlim(-5, 25)
plt.savefig("abc.png")
plt.show()
推荐答案
也许可以独立保存图片
from google.colab import files
plt.savefig("abc.png")
files.download("abc.png")
这篇关于在 colaboratory 上使用 plt.savefig 保存数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文