Colorplot of 2D array matplotlib

后端 未结 2 677
南方客
南方客 2021-02-06 22:01

So, I thought this was going to be really simple, but I\'ve been having a lot of difficult finding exactly what I\'m looking for in a comprehensible example.

Basically I

2条回答
  •  醉酒成梦
    2021-02-06 22:24

    Here is the simplest example that has the key lines of code:

    import numpy as np 
    import matplotlib.pyplot as plt
    
    H = np.array([[1, 2, 3, 4],
              [5, 6, 7, 8],
              [9, 10, 11, 12],
              [13, 14, 15, 16]])
    
    plt.imshow(H, interpolation='none')
    plt.show()
    

提交回复
热议问题