Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8139afc

Browse files
committed
Merge pull request #4870 from ericmjl/matshow.py_mep12
mep12 on matshow.py
2 parents d22f626 + 8fd77f2 commit 8139afc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/pylab_examples/matshow.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
"""Simple matshow() example."""
2-
from matplotlib.pylab import *
2+
import matplotlib.pyplot as plt
3+
import numpy as np
34

45

56
def samplemat(dims):
67
"""Make a matrix with all zeros and increasing elements on the diagonal"""
7-
aa = zeros(dims)
8+
aa = np.zeros(dims)
89
for i in range(min(dims)):
910
aa[i, i] = i
1011
return aa
1112

12-
1313
# Display 2 matrices of different sizes
1414
dimlist = [(12, 12), (15, 35)]
1515
for d in dimlist:
16-
matshow(samplemat(d))
16+
plt.matshow(samplemat(d))
1717

1818
# Display a random matrix with a specified figure number and a grayscale
1919
# colormap
20-
matshow(rand(64, 64), fignum=100, cmap=cm.gray)
20+
plt.matshow(np.random.rand(64, 64), fignum=100, cmap=plt.cm.gray)
2121

22-
show()
22+
plt.show()

0 commit comments

Comments
 (0)