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.
1 parent 7552cee commit e1edb58Copy full SHA for e1edb58
pyro/util/plot_tools.py
@@ -6,6 +6,15 @@
6
import matplotlib.pyplot as plt
7
from mpl_toolkits.axes_grid1 import ImageGrid
8
9
+from pyro.util import msg
10
+
11
12
+# This is defined in the module scope instead of as a closure in setup_axes()
13
+# so it doesn't get added to the list of callbacks multiple times.
14
+def _key_handler(event):
15
+ if event.key == "ctrl+c":
16
+ msg.fail("ABORT: KeyboardInterrupt")
17
18
19
def setup_axes(myg, num):
20
""" create a grid of axes whose layout depends on the aspect ratio of the
@@ -15,6 +24,7 @@ def setup_axes(myg, num):
24
L_y = myg.ymax - myg.ymin
25
26
f = plt.figure(1)
27
+ f.canvas.mpl_connect("key_press_event", _key_handler)
28
29
cbar_title = False
30
0 commit comments