Skip to content

pyplot.annotate() API deprecation #15142

Closed
@amaeckelberghe

Description

@amaeckelberghe

Bug report

Bug summary

I wanted to update my code that annotates a plot by changed the deprecated keyword argument s to text as described in the documentation of matplotlib v3.1.1. However it fails to recognise text as an argument and requests s instead.

Code for reproduction

import matplotlib
import matplotlib.pyplot as plt


print(matplotlib.__version__)
print(matplotlib.get_backend())
matplotlib.pyplot.plot()
matplotlib.pyplot.annotate('without keyword', xy=(0.5, 0.75))
matplotlib.pyplot.annotate(s='keyword "s"', xy=(0.5, 0.5))
matplotlib.pyplot.annotate(text='keyword "test"', xy=(0.5, 0.25))

Actual outcome

image

3.1.1
TkAgg
Traceback (most recent call last):
  File "<input>", line 9, in <module>
TypeError: annotate() missing 1 required positional argument: 's'

Expected outcome

I would expect that the keyword we should use in version 3.1.1 would be 'text' since in the documentation (https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.annotate.html) it says:

Parameters: text : str The text of the annotation. s is a deprecated synonym for this parameter.

Matplotlib version

  • Operating system: Windows
  • Matplotlib version: 3.1.1
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.7.4

I installed matplotlib through pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions