matshow.py

来自「非原创。很好的python例子」· Python 代码 · 共 23 行

PY
23
字号
#!/usr/bin/env python"""Simple matshow() example."""from matplotlib.pylab import *def samplemat(dims):    """Make a matrix with all zeros and increasing elements on the diagonal"""    aa = zeros(dims)    for i in range(min(dims)):        aa[i,i] = i    return aa# Make a few matrices of strange sizesdimlist = [(12,12),(128,64),(64,512),(1024,128)]for d in dimlist:    matshow(samplemat(d))# Display a random matrix with a specified figure number and a grayscale colormapmatshow(rand(64,64),fignum=100,cmap=cm.gray)show()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?