Skip to content

Commit 982e449

Browse files
committed
Merge remote-tracking branch 'upstream/main' into polar-coords
2 parents e0b136f + e1edb58 commit 982e449

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

pyro/util/plot_tools.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
import matplotlib.pyplot as plt
77
from mpl_toolkits.axes_grid1 import ImageGrid
88

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+
918

1019
def setup_axes(myg, num):
1120
""" create a grid of axes whose layout depends on the aspect ratio of the
@@ -15,6 +24,7 @@ def setup_axes(myg, num):
1524
L_y = myg.ymax - myg.ymin
1625

1726
f = plt.figure(1)
27+
f.canvas.mpl_connect("key_press_event", _key_handler)
1828

1929
cbar_title = False
2030

0 commit comments

Comments
 (0)