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.
2 parents 676be8b + efa6240 commit 7357285Copy full SHA for 7357285
lib/matplotlib/figure.py
@@ -1232,6 +1232,17 @@ def _gci(self):
1232
helper for :func:`~matplotlib.pyplot.gci`;
1233
do not use elsewhere.
1234
"""
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.
1246
for ax in reversed(self.axes):
1247
im = ax._gci()
1248
if im is not None:
0 commit comments