在 python matplotlib 中绘制白色灰度图像
Plotting a white grayscale image in python matplotlib
这应该非常简单,但我遗漏了一些东西。目的是在 matplotlib 中创建和绘制白色图像。下面的代码应该很接近,但它绘制了一个黑色图像。我错过了什么?
import numpy as np
import matplotlib.pyplot as plt
height = 100
white = np.ones((height, height), dtype=np.float)
print white
plt.imshow(white, cmap='gray')
plt.show()
使用
plt.imshow(white, cmap='gray',vmin=0,vmax=1)
这应该非常简单,但我遗漏了一些东西。目的是在 matplotlib 中创建和绘制白色图像。下面的代码应该很接近,但它绘制了一个黑色图像。我错过了什么?
import numpy as np
import matplotlib.pyplot as plt
height = 100
white = np.ones((height, height), dtype=np.float)
print white
plt.imshow(white, cmap='gray')
plt.show()
使用
plt.imshow(white, cmap='gray',vmin=0,vmax=1)