8000 simple matshow example · matplotlib/matplotlib@e6b6081 · GitHub
[go: up one dir, main page]

Skip to content

Commit e6b6081

Browse files
committed
simple matshow example
svn path=/trunk/matplotlib/; revision=960
1 parent 1ebd345 commit e6b6081

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

examples/matshow.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Simple matshow() example."""
3+
4+
from matplotlib.pylab import *
5+
6+
def samplemat(dims):
7+
"""Make a matrix with all zeros and increasing elements on the diagonal"""
8+
aa = zeros(dims)
9+
for i in range(min(dims)):
10+
aa[i,i] = i
11+
return aa
12+
13+
# Make a few matrices of strange sizes
14+
dimlist = [(12,12),(128,64),(64,512),(1024,128)]
15+
16+
for d in dimlist:
17+
matshow(samplemat(d))
18+
19+
# Display a random matrix with a specified figure number and a grayscale colormap
20+
matshow(rand(64,64),fignum=100,cmap=cm.gray)
21+
22+
show()

0 commit comments

Comments
 (0)
0