python imshow grayscale static color values

后端 未结 1 900
小鲜肉
小鲜肉 2021-01-17 02:40

I understand using matplotlib.pyplot\'s imshow gives me a nice sketch that can be used to visualize matrices. My question is that when I want to visualize a matrix, the func

相关标签:
1条回答
  • 2021-01-17 03:19

    You can use the vmin and vmax keyword arguments of imshow as documented here. In particular, if you modify your imshow call to

    plt.imshow(k, vmin=0, vmax=1)
    

    the colours will be normalised as if there was a value 0 and a value 1 present in the data.

    0 讨论(0)
提交回复
热议问题