Matshow
简单的 matshow 例子。
import matplotlib.pyplot as plt
import numpy as np
def samplemat(dims):
"""Make a matrix with all zeros and increasing elements on the diagonal"""
aa = np.zeros(dims)
for i in range(min(dims)):
aa[i, i] = i
return aa
# Display matrix
plt.matshow(samplemat((15, 15)))
plt.show()
参考
此示例中显示了以下函数和方法的用法:
import matplotlib
matplotlib.axes.Axes.matshow
matplotlib.pyplot.matshow