-
Notifications
You must be signed in to change notification settings - Fork 0
/
myplot.py
53 lines (39 loc) · 1.16 KB
/
myplot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import matplotlib.pyplot as plt
def close_event():
plt.close()
def timed_plot_double(img1, img2, title1='', title2=''):
# Setup a timer
# fig = plt.figure()
# timer = fig.canvas.new_timer(interval=500)
# timer.add_callback(close_event)
# Do the plotting
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
f.tight_layout()
ax1.imshow(img1, cmap='gray')
ax1.set_title(title1, fontsize=20)
ax2.imshow(img2, cmap='gray')
ax2.set_title(title2, fontsize=20)
# Show with timer
# timer.start()
#plt.draw()
plt.show(block=False)
plt.pause(.00001)
plt.close()
def plot_double(img1, img2, title1='', title2=''):
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
f.tight_layout()
ax1.imshow(img1)
ax1.set_title(title1, fontsize=20)
ax2.imshow(img2)
ax2.set_title(title2, fontsize=20)
# plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)
plt.show()
def plot(img, title='', is_block=True):
plt.imshow(img)
plt.title(title)
plt.show(block=is_block)
def timed_plot(img, title=''):
plt.imshow(img)
plt.show(block=False)
plt.pause(0.00001)
plt.close()