Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backport PR #13548 on branch v3.1.x (Deprecate TextWithDash.)#13557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionsdoc/api/next_api_changes/2019-03-01-AL.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
Deprecations
````````````

The ``text.TextWithDash`` class and the ``withdash`` keyword argument to
``text()`` is deprecated. Consider using ``annotate()`` instead.
6 changes: 6 additions & 0 deletionsexamples/text_labels_and_annotations/dashpointlabel.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,8 +4,13 @@
===============

"""

import warnings

import matplotlib.pyplot as plt

warnings.simplefilter("ignore") # Ignore deprecation of withdash.

DATA = ((1, 3),
(2, 4),
(3, 1),
Expand DownExpand Up@@ -36,5 +41,6 @@

ax.set_xlim((0, 5))
ax.set_ylim((0, 5))
ax.set(title="NOTE: The withdash parameter is deprecated.")

plt.show()
4 changes: 3 additions & 1 deletionlib/matplotlib/axes/_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -673,6 +673,7 @@ def secondary_yaxis(self, location, *, functions=None, **kwargs):
raise ValueError('secondary_yaxis location must be either '
'a float or "left"/"right"')

@cbook._delete_parameter("3.1", "withdash")
def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
"""
Add text to the axes.
Expand DownExpand Up@@ -748,7 +749,8 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
# the withdash kwarg and simply delegate whether there's
# a dash to TextWithDash and dashlength.

if withdash:
if (withdash
and withdash is not cbook.deprecation._deprecated_parameter):
t = mtext.TextWithDash(x, y, text=s)
else:
t = mtext.Text(x, y, text=s)
Expand Down
1 change: 1 addition & 0 deletionslib/matplotlib/figure.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1804,6 +1804,7 @@ def legend(self, *args, **kwargs):
self.stale = True
return l

@cbook._delete_parameter("3.1", "withdash")
@docstring.dedent_interpd
def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
"""
Expand Down
4 changes: 3 additions & 1 deletionlib/matplotlib/pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2936,7 +2936,9 @@ def table(

# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@docstring.copy(Axes.text)
def text(x, y, s, fontdict=None, withdash=False, **kwargs):
def text(
x, y, s, fontdict=None,
withdash=cbook.deprecation._deprecated_parameter, **kwargs):
return gca().text(x, y, s, fontdict=fontdict, withdash=withdash, **kwargs)


Expand Down
1 change: 1 addition & 0 deletionslib/matplotlib/text.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1245,6 +1245,7 @@ def set_fontname(self, fontname):
docstring.dedent_interpd(Text.__init__)


@cbook.deprecated("3.1", alternative="Annotation")
class TextWithDash(Text):
"""
This is basically a :class:`~matplotlib.text.Text` with a dash
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp