【发布时间】:2017-03-20 12:54:46
【问题描述】:
我想使用 plt.savefig() 保存从 numpy 数组创建的图像,但它失败了。我的图像是空白的。我的代码如下。
import matplotlib.pyplot as plt
import numpy as np
array = np.arange(10000).reshape((100,100))
plt.savefig('test.png', dpi = 300)
plt.imshow(array)
【问题讨论】:
-
您要创建什么样的图像?
-
您没有创建任何图形(为此使用 plt.plot())。 matplotlib.org/users/pyplot_tutorial.html
-
@Nick Hale 喜欢遥感影像。