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

Appearance settings

Commit d3559c6

Browse filesBrowse files
authored
Merge pull request #13557 from meeseeksmachine/auto-backport-of-pr-13548-on-v3.1.x
Backport PR #13548 on branch v3.1.x (Deprecate TextWithDash.)
2 parents 334d875 + d5c63c9 commit d3559c6
Copy full SHA for d3559c6

File tree

Expand file treeCollapse file tree

6 files changed

+19
-2
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+19
-2
lines changed
+5Lines 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

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/dashpointlabel.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
===============
55
66
"""
7+
8+
import warnings
9+
710
import matplotlib.pyplot as plt
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

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+3-1Lines 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
raise ValueError('secondary_yaxis location must be either '
674674
'a float or "left"/"right"')
675675

676+
@cbook._delete_parameter("3.1", "withdash")
676677
def text(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-
if withdash:
752+
if (withdash
753+
and withdash is not cbook.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

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+1Lines 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
return l
18061806

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

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+3-1Lines 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-
def text(x, y, s, fontdict=None, withdash=False, **kwargs):
2939+
def text(
2940+
x, y, s, fontdict=None,
2941+
withdash=cbook.deprecation._deprecated_parameter, **kwargs):
29402942
return gca().text(x, y, s, fontdict=fontdict, withdash=withdash, **kwargs)
29412943

29422944

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+1Lines 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
class TextWithDash(Text):
12491250
"""
12501251
This is basically a :class:`~matplotlib.text.Text` with a dash

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.