In [1]:
import numpy as np
import matplotlib.pyplot as plt
In [2]:
A = [[1,2],[1,4]]

plt.imshow(A) #image show

plt.xticks([0,1])
plt.yticks([.85,1.04])

plt.show()
In [3]:
A = np.zeros((10,14))
print(np.shape(A))
print(A)
(10, 14)
[[0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]
In [4]:
for i in range(0,np.shape(A)[0]):
    for j in range(0,np.shape(A)[1]):
        A[i,j] = 3*i - 4*j
        #plt.text(j,i,int(A[i,j]),horizontalalignment='center',verticalalignment='center')
        
print(A)
plt.imshow(A)
plt.plot([0,3],[8,2],'r',linewidth=4)

for i in range(0,np.shape(A)[0]):
    for j in range(0,np.shape(A)[1]):
        plt.text(j,i,int(A[i,j]),horizontalalignment='center',verticalalignment='center')
        
plt.set_cmap('summer') # search 'python colormaps'
plt.show()
[[  0.  -4.  -8. -12. -16. -20. -24. -28. -32. -36. -40. -44. -48. -52.]
 [  3.  -1.  -5.  -9. -13. -17. -21. -25. -29. -33. -37. -41. -45. -49.]
 [  6.   2.  -2.  -6. -10. -14. -18. -22. -26. -30. -34. -38. -42. -46.]
 [  9.   5.   1.  -3.  -7. -11. -15. -19. -23. -27. -31. -35. -39. -43.]
 [ 12.   8.   4.   0.  -4.  -8. -12. -16. -20. -24. -28. -32. -36. -40.]
 [ 15.  11.   7.   3.  -1.  -5.  -9. -13. -17. -21. -25. -29. -33. -37.]
 [ 18.  14.  10.   6.   2.  -2.  -6. -10. -14. -18. -22. -26. -30. -34.]
 [ 21.  17.  13.   9.   5.   1.  -3.  -7. -11. -15. -19. -23. -27. -31.]
 [ 24.  20.  16.  12.   8.   4.   0.  -4.  -8. -12. -16. -20. -24. -28.]
 [ 27.  23.  19.  15.  11.   7.   3.  -1.  -5.  -9. -13. -17. -21. -25.]]