Skip to content

Annotation change from "s" to "text" in 3.0- documentation #12325

Closed

Description

@jason-neal

Bug report

Bug summary
Annotation argument has changed from 2.2.3 to 3.0 but I do not think it has been fully documented.

The documentation here is not to date with s still the keyword shown in parameter list (although it has text in the definition) https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.annotate.html#matplotlib.axes.Axes.annotate

Code for reproduction

#!/usr/bin/env python
import matplotlib
import sys
print(sys.version)
print(matplotlib.__version__)
import matplotlib.pyplot as plt

plt.figure()
a = plt.annotate(s="test", xy=(0.5, 0.5))
print(a)

Actual outcome
Here is the outcome in two different version of matplotlib.

/home/jneal/miniconda3/envs/py36/bin/python /home/jneal/Phd/Codes/annotatetest.py
3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 
[GCC 7.2.0]
2.2.3
Annotation(0.5,0.5,'test')

Process finished with exit code 0

and

3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 
[GCC 7.2.0]
3.0.0
Traceback (most recent call last):
  File "annotatetest.py", line 10, in <module>
    a = plt.annotate(s="test", xy=(0.5, 0.5))
TypeError: annotate() missing 1 required positional argument: 'text'

Expected outcome
I did not expect it to have changed.

If I change s to text then I have the same problem in reverse if trying to use both versions
( I do know that the arg name can be omitted)

Matplotlib version
conda installed matplotlib from conda-forge

Activity

  1. added this to the v3.0.x milestone on Sep 28, 2018
  2. jklymak commented on Sep 28, 2018

    @jklymak
    Member

    This was #10830 @timhoffm is there a way to make text and s both work, or should we just use s. The docs indeed say s...

  3. anntzer commented on Oct 1, 2018

    @anntzer
    Contributor

    Actually I would propose to revert the specific change to annotate in #10830 to switch back to s only; it doesn't make sense to have different kwarg names to annotate() and to text().

  4. added
    API: changesChanges to the public API, typically requiring deprecation.
    and removed on Oct 1, 2018
  5. timhoffm commented on Oct 1, 2018

    @timhoffm
    Member

    Will care for this tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: changesChanges to the public API, typically requiring deprecation.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions