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

Skip to content

Commit ba34a85

Browse files
committed
Rename annotate parameter to match upstream
Run boilerplate.py change version rename takes effect Co-Authored-By: Thomas A Caswell <[email protected]> Release note of variable change Rebased onto newer master Address doc building
1 parent e92685a commit ba34a85

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
@@ -753,9 +753,10 @@ def text(self, x, y, s, fontdict=None, **kwargs):
753753
self._add_text(t)
754754
return t
755755

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

lib/matplotlib/pyplot.py

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

22512251
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
22522252
@_copy_docstring_and_deprecators(Axes.annotate)
2253-
def annotate(s, xy, *args, **kwargs):
2254-
return gca().annotate(s, xy, *args, **kwargs)
2253+
def annotate(text, xy, *args, **kwargs):
2254+
return gca().annotate(text, xy, *args, **kwargs)
22552255

22562256

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

0 commit comments

Comments
 (0)