File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 17
17
18
18
"""
19
19
20
- from pylab import *
20
+ import matplotlib .pyplot as plt
21
+ import numpy as np
21
22
22
23
# two images x1 is initially visible, x2 is not
23
- x1 = rand ( 100 , 100 )
24
- x2 = rand ( 150 , 175 )
24
+ x1 = np . random . random (( 100 , 100 ) )
25
+ x2 = np . random . random (( 150 , 175 ) )
25
26
26
27
# arbitrary extent - both images must have same extent if you want
27
28
# them to be resampled into the same axes space
28
29
extent = (0 , 1 , 0 , 1 )
29
- im1 = imshow (x1 , extent = extent )
30
- im2 = imshow (x2 , extent = extent , hold = True )
30
+ im1 = plt . imshow (x1 , extent = extent )
31
+ im2 = plt . imshow (x2 , extent = extent , hold = True )
31
32
im2 .set_visible (False )
32
33
33
34
@@ -39,8 +40,8 @@ def toggle_images(event):
39
40
b2 = im2 .get_visible ()
40
41
im1 .set_visible (not b1 )
41
42
im2 .set_visible (not b2 )
42
- draw ()
43
+ plt . draw ()
43
44
44
- connect ('key_press_event' , toggle_images )
45
+ plt . connect ('key_press_event' , toggle_images )
45
46
46
- show ()
47
+ plt . show ()
You can’t perform that action at this time.
0 commit comments