Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e078bc

Browse files
lpsingertimhoffm
andauthored
Update lib/matplotlib/figure.py
Co-authored-by: Tim Hoffmann <[email protected]>
1 parent 261b9c5 commit 3e078bc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/matplotlib/figure.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,12 +1444,10 @@ def gca(self, **kwargs):
14441444
"axes, or if no axes exist, create new axes with default "
14451445
"keyword arguments. To create a new axes with non-default "
14461446
"arguments, use plt.axes() or plt.subplot().")
1447-
cax = self._axstack()
1448-
if cax is None:
1449-
# no axes found, so create one which spans the figure
1447+
if self._axstack.empty():
14501448
return self.add_subplot(1, 1, 1, **kwargs)
14511449
else:
1452-
return cax
1450+
return self._axstack()
14531451

14541452
def _gci(self):
14551453
# Helper for `~matplotlib.pyplot.gci`. Do not use elsewhere.

0 commit comments

Comments
 (0)