Matshow

简单的 matshow 例子。

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. def samplemat(dims):
  4. """Make a matrix with all zeros and increasing elements on the diagonal"""
  5. aa = np.zeros(dims)
  6. for i in range(min(dims)):
  7. aa[i, i] = i
  8. return aa
  9. # Display matrix
  10. plt.matshow(samplemat((15, 15)))
  11. plt.show()

matshow示例

参考

此示例中显示了以下函数和方法的用法:

  1. import matplotlib
  2. matplotlib.axes.Axes.matshow
  3. matplotlib.pyplot.matshow

下载这个示例