Skip to content

Commit efa6240

Browse files
committed
Merge remote-tracking branch 'upstream/v1.2.x' into v1.3.x
2 parents 6d8237f + b0f06f0 commit efa6240

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/matplotlib/figure.py

+11
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,17 @@ def _gci(self):
12321232
helper for :func:`~matplotlib.pyplot.gci`;
12331233
do not use elsewhere.
12341234
"""
1235+
# Look first for an image in the current Axes:
1236+
cax = self._axstack.current_key_axes()[1]
1237+
if cax is None:
1238+
return None
1239+
im = cax._gci()
1240+
if im is not None:
1241+
return im
1242+
1243+
# If there is no image in the current Axes, search for
1244+
# one in a previously created Axes. Whether this makes
1245+
# sense is debatable, but it is the documented behavior.
12351246
for ax in reversed(self.axes):
12361247
im = ax._gci()
12371248
if im is not None:

0 commit comments

Comments
 (0)