2020
10-08
10-08
matplotlib.pyplot.matshow 矩阵可视化实例
这是一个绘制矩阵的函数。用matshow绘制矩阵的例子:importmatplotlib.pyplotaspltimportnumpyasnpdefsamplemat(dims):"""Makeamatrixwithallzerosandincreasingelementsonthediagonal"""aa=np.zeros(dims)foriinrange(min(dims)):aa[i,i]=ireturnaa#Displaymatrixplt.matshow(samplemat((15,15)))plt.show()效果图:补充知识:利用matplotlib将矩阵画成三维图importcv2ascvimportnum...
继续阅读 >