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 72af8a4 commit fd1ddafCopy full SHA for fd1ddaf
lib/matplotlib/figure.py
@@ -1204,6 +1204,17 @@ def _gci(self):
1204
helper for :func:`~matplotlib.pyplot.gci`;
1205
do not use elsewhere.
1206
"""
1207
+ # Look first for an image in the current Axes:
1208
+ cax = self._axstack.current_key_axes()[1]
1209
+ if cax is None:
1210
+ return None
1211
+ im = cax._gci()
1212
+ if im is not None:
1213
+ return im
1214
+
1215
+ # If there is no image in the current Axes, search for
1216
+ # one in a previously created Axes. Whether this makes
1217
+ # sense is debatable, but it is the documented behavior.
1218
for ax in reversed(self.axes):
1219
im = ax._gci()
1220
if im is not None:
0 commit comments