【发布时间】:2018-11-29 22:04:33
【问题描述】:
我在 Google Colaboratory 中使用 matplotlib 并尝试将绘图图像保存在某处(在本地下载或上传到 Google Drive)。我目前正在内联显示图像:
plt.show()
这是我尝试过的,虽然它只下载一个空白图像:
import os
local_download_path = os.path.expanduser('~/data')
plot_filepath = os.path.join(local_download_path, "plot.png")
plt.savefig(plot_filepath)
from google.colab import files
files.download(plot_filepath)
我也尝试使用 Drive API 上传绘图图像,但也没有成功。
【问题讨论】:
-
可以直接右键保存图片吗?
-
是的,但我正在生成许多图。
标签: matplotlib google-colaboratory