Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python matplotlib中绘制白色灰度图像_Python_Matplotlib - Fatal编程技术网

在python matplotlib中绘制白色灰度图像

在python matplotlib中绘制白色灰度图像,python,matplotlib,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() 使用

这应该是令人尴尬的简单,但我遗漏了一些东西。其目的是在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)