Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d22f626 + 8fd77f2 commit 8139afcCopy full SHA for 8139afc
1 file changed
examples/pylab_examples/matshow.py
@@ -1,22 +1,22 @@
1
"""Simple matshow() example."""
2
-from matplotlib.pylab import *
+import matplotlib.pyplot as plt
3
+import numpy as np
4
5
6
def samplemat(dims):
7
"""Make a matrix with all zeros and increasing elements on the diagonal"""
- aa = zeros(dims)
8
+ aa = np.zeros(dims)
9
for i in range(min(dims)):
10
aa[i, i] = i
11
return aa
12
-
13
# Display 2 matrices of different sizes
14
dimlist = [(12, 12), (15, 35)]
15
for d in dimlist:
16
- matshow(samplemat(d))
+ plt.matshow(samplemat(d))
17
18
# Display a random matrix with a specified figure number and a grayscale
19
# colormap
20
-matshow(rand(64, 64), fignum=100, cmap=cm.gray)
+plt.matshow(np.random.rand(64, 64), fignum=100, cmap=plt.cm.gray)
21
22
-show()
+plt.show()
0 commit comments