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

Skip to content

Commit 2f28286

Browse files
authored
Merge pull request #9928 from timhoffm/cleanup-delaxes
Cleanup delaxes()
2 parents 0943a6c + 2fc62a4 commit 2f28286

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

lib/matplotlib/figure.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,11 @@ def set_frameon(self, b):
864864
self.frameon = b
865865
self.stale = True
866866

867-
def delaxes(self, a):
868-
'remove a from the figure and update the current axes'
869-
self._axstack.remove(a)
867+
def delaxes(self, ax):
868+
"""
869+
Remove the `~.Axes` *ax* from the figure and update the current axes.
870+
"""
871+
self._axstack.remove(ax)
870872
for func in self._axobservers:
871873
func(self)
872874
self.stale = True

lib/matplotlib/pyplot.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -919,19 +919,14 @@ def axes(*args, **kwargs):
919919
return a
920920

921921

922-
def delaxes(*args):
922+
def delaxes(ax=None):
923923
"""
924-
Remove an axes from the current figure. If *ax*
925-
doesn't exist, an error will be raised.
926-
927-
``delaxes()``: delete the current axes
924+
Remove the given `Axes` *ax* from the current figure. If *ax* is *None*,
925+
the current axes is removed. A KeyError is raised if the axes doesn't exist.
928926
"""
929-
if not len(args):
927+
if ax is None:
930928
ax = gca()
931-
else:
932-
ax = args[0]
933-
ret = gcf().delaxes(ax)
934-
return ret
929+
gcf().delaxes(ax)
935930

936931

937932
def sca(ax):

0 commit comments

Comments
 (0)