Skip to content

Commit 8417223

Browse files
committed
Rename annotate parameter to match upstream
Run boilerplate.py change version rename takes effect Co-Authored-By: Thomas A Caswell <tcaswell@gmail.com> Release note of variable change Rebased onto newer master
1 parent eb00861 commit 8417223

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Changes in parameter names
2+
``````````````````````````
3+
4+
The parameter ``s`` to `.Axes.annotate` renamed to ``text``, matching
5+
`Annotation`.
6+
This change propegates to ``pyplot.annotate``.
7+
8+
The old parameter name remains supported for `.Axes.annotate`, but
9+
support for it will be dropped in a future Matplotlib release.

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,10 @@ def text(self, x, y, s, fontdict=None, **kwargs):
754754
self._add_text(t)
755755
return t
756756

757+
@cbook._rename_parameter("3.2", "s", "text")
757758
@docstring.dedent_interpd
758-
def annotate(self, s, xy, *args, **kwargs):
759-
a = mtext.Annotation(s, xy, *args, **kwargs)
759+
def annotate(self, text, xy, *args, **kwargs):
760+
a = mtext.Annotation(text, xy, *args, **kwargs)
760761
a.set_transform(mtransforms.IdentityTransform())
761762
if 'clip_on' in kwargs:
762763
a.set_clip_path(self.patch)

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,8 +2214,8 @@ def angle_spectrum(
22142214

22152215
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22162216
@docstring.copy(Axes.annotate)
2217-
def annotate(s, xy, *args, **kwargs):
2218-
return gca().annotate(s, xy, *args, **kwargs)
2217+
def annotate(text, xy, *args, **kwargs):
2218+
return gca().annotate(text, xy, *args, **kwargs)
22192219

22202220

22212221
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.

0 commit comments

Comments
 (0)