Skip to content

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

Closed
@jason-neal

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions