关于matplotlib及相关cmap参数的取值

关于matplotlib及相关cmap参数的取值

在matplotlib中对于图片的显示有如下方法(这不是重点), 其中有cmap=‘binary’的参数。

plt.imshow(imgs[i].reshape(28, 28), cmap='binary')
#或如下:也可以达到相同的效果
plt.imshow(imgs[i].reshape(28, 28), cmap=plt.get_cmap('binary'))

这 是对显示颜色参数的定义,它可以有很多渐变色可以选择:
具体取值详细参见:
https://matplotlib.org/users/colormaps.html
https://matplotlib.org/examples/color/colormaps_reference.html

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_30934313/article/details/85249831