10000 Fix docstring of Axes.cla() · matplotlib/matplotlib@d978b3b · GitHub
[go: up one dir, main page]

Skip to content

Commit d978b3b

Browse files
committed
Fix docstring of Axes.cla()
The docstring was written for pyplot.cla() but "current" is incorrect for the Axes method. Also, Axes.cla() and Axes.clear() should have the same docstring as they are synonyms. To support a different docstring in pyplot, I had to explicitly define pyplot.cla() and remove it from boilerplate.py generation. Given that the function is trivial, this is an ok tradeoff for a better docstring on the Axes.
1 parent 4b244a7 commit d978b3b

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ def sharey(self, other):
10881088
self.yaxis._scale = other.yaxis._scale
10891089

10901090
def cla(self):
1091-
"""Clear the current axes."""
1091+
"""Clear the axes."""
10921092
# Note: this is called by Axes.__init__()
10931093

10941094
# stash the current visibility state

lib/matplotlib/pyplot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,12 @@ def sca(ax):
10641064
ax.figure.sca(ax)
10651065

10661066

1067+
def cla():
1068+
"""Clear the current axes."""
1069+
# Not generated via boilerplate.py to allow a different docstring.
1070+
return gca().cla()
1071+
1072+
10671073
## More ways of creating axes ##
10681074

10691075
@docstring.dedent_interpd
@@ -2626,12 +2632,6 @@ def broken_barh(xranges, yrange, *, data=None, **kwargs):
26262632
**({"data": data} if data is not None else {}), **kwargs)
26272633

26282634

2629-
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
2630-
@_copy_docstring_and_deprecators(Axes.cla)
2631-
def cla():
2632-
return gca().cla()
2633-
2634-
26352635
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26362636
@_copy_docstring_and_deprecators(Axes.clabel)
26372637
def clabel(CS, levels=None, **kwargs):

tools/boilerplate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ def boilerplate_gen():
201201
'barh',
202202
'boxplot',
203203
'broken_barh',
204-
'cla',
205204
'clabel',
206205
'cohere',
207206
'contour',

0 commit comments

Comments
 (0)
0