File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
"""Simple matshow() example."""
2
- from matplotlib .pylab import *
2
+ import matplotlib .pyplot as plt
3
+ import numpy as np
3
4
4
5
5
6
def samplemat (dims ):
6
7
"""Make a matrix with all zeros and increasing elements on the diagonal"""
7
- aa = zeros (dims )
8
+ aa = np . zeros (dims )
8
9
for i in range (min (dims )):
9
10
aa [i , i ] = i
10
11
return aa
11
12
12
-
13
13
# Display 2 matrices of different sizes
14
14
dimlist = [(12 , 12 ), (15 , 35 )]
15
15
for d in dimlist :
16
- matshow (samplemat (d ))
16
+ plt . matshow (samplemat (d ))
17
17
18
18
# Display a random matrix with a specified figure number and a grayscale
19
19
# 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 )
21
21
22
- show ()
22
+ plt . show ()
You can’t perform that action at this time.
0 commit comments