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

Commitd5c63c9

Browse files
anntzerMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR#13548: Deprecate TextWithDash.
1 parent334d875 commitd5c63c9

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
The ``text.TextWithDash`` class and the ``withdash`` keyword argument to
5+
``text()`` is deprecated. Consider using ``annotate()`` instead.

‎examples/text_labels_and_annotations/dashpointlabel.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
===============
55
66
"""
7+
8+
importwarnings
9+
710
importmatplotlib.pyplotasplt
811

12+
warnings.simplefilter("ignore")# Ignore deprecation of withdash.
13+
914
DATA= ((1,3),
1015
(2,4),
1116
(3,1),
@@ -36,5 +41,6 @@
3641

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

4046
plt.show()

‎lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ def secondary_yaxis(self, location, *, functions=None, **kwargs):
673673
raiseValueError('secondary_yaxis location must be either '
674674
'a float or "left"/"right"')
675675

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

751-
ifwithdash:
752+
if (withdash
753+
andwithdashisnotcbook.deprecation._deprecated_parameter):
752754
t=mtext.TextWithDash(x,y,text=s)
753755
else:
754756
t=mtext.Text(x,y,text=s)

‎lib/matplotlib/figure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,7 @@ def legend(self, *args, **kwargs):
18041804
self.stale=True
18051805
returnl
18061806

1807+
@cbook._delete_parameter("3.1","withdash")
18071808
@docstring.dedent_interpd
18081809
deftext(self,x,y,s,fontdict=None,withdash=False,**kwargs):
18091810
"""

‎lib/matplotlib/pyplot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2936,7 +2936,9 @@ def table(
29362936

29372937
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
29382938
@docstring.copy(Axes.text)
2939-
deftext(x,y,s,fontdict=None,withdash=False,**kwargs):
2939+
deftext(
2940+
x,y,s,fontdict=None,
2941+
withdash=cbook.deprecation._deprecated_parameter,**kwargs):
29402942
returngca().text(x,y,s,fontdict=fontdict,withdash=withdash,**kwargs)
29412943

29422944

‎lib/matplotlib/text.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,7 @@ def set_fontname(self, fontname):
12451245
docstring.dedent_interpd(Text.__init__)
12461246

12471247

1248+
@cbook.deprecated("3.1",alternative="Annotation")
12481249
classTextWithDash(Text):
12491250
"""
12501251
This is basically a :class:`~matplotlib.text.Text` with a dash

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp