Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 567bf46

Browse files
committed
Remove more API deprecated in 3.1
1 parent 2f6a7a4 commit 567bf46

File tree

5 files changed

+10
-86
lines changed

5 files changed

+10
-86
lines changed

doc/api/next_api_changes/removals.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ Classes and methods
7373
- ``scale.NaturalLogTransform`` (use ``scale.LogTransform`` instead)
7474
- ``scale.InvertedNaturalLogTransform`` (use ``scale.InvertedLogTransform`` instead)
7575

76+
- ``spines.Spine.is_frame_like()`` (no replacement)
77+
78+
- ``text.Text.is_math_text()`` (use ``cbook.is_math_text()`` instead)
79+
- ``text.TextWithDash()`` (use ``text.Annotation`` instead)
80+
- ``textpath.TextPath.is_math_text()`` (use ``cbook.is_math_text()`` instead)
81+
- ``textpath.TextPath.text_get_vertices_codes()``
82+
(use ``textpath.text_to_path.get_text_path()`` instead)
83+
7684
- ``ticker.OldScalarFormatter.pprint_val()`` (no replacement)
7785
- ``ticker.ScalarFormatter.pprint_val()`` (no replacement)
7886
- ``ticker.LogFormatter.pprint_val()`` (no replacement)
@@ -112,8 +120,6 @@ Classes and methods
112120
- ``path.get_paths_extents()``
113121
(use ``path.get_path_collection_extents()`` instead)
114122

115-
- ``text.TextWithDash`` (use ``text.Annotation`` instead)
116-
117123
- ``mplot3d.proj3d.line2d()`` (no replacement)
118124
- ``mplot3d.proj3d.line2d_dist()`` (no replacement)
119125
- ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement)
@@ -142,6 +148,8 @@ Classes and methods
142148
- ``axisartist.axislines.Axes.AxisDict``
143149
(use ``axis_grid1.mpl_axes.Axes.AxisDict`` instead)
144150

151+
- ``widgets.SpanSelector.buttonDown`` property (no replacement)
152+
145153
Arguments
146154
~~~~~~~~~
147155
- ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash``

lib/matplotlib/spines.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -240,28 +240,6 @@ def cla(self):
240240
if self.axis is not None:
241241
self.axis.cla()
242242

243-
@cbook.deprecated("3.1")
244-
def is_frame_like(self):
245-
"""Return True if directly on axes frame.
246-
247-
This is useful for determining if a spine is the edge of an
248-
old style MPL plot. If so, this function will return True.
249-
"""
250-
self._ensure_position_is_set()
251-
position = self._position
252-
if isinstance(position, str):
253-
if position == 'center':
254-
position = ('axes', 0.5)
255-
elif position == 'zero':
256-
position = ('data', 0)
257-
if len(position) != 2:
258-
raise ValueError("position should be 2-tuple")
259-
position_type, amount = position
260-
if position_type == 'outward' and amount == 0:
261-
return True
262-
else:
263-
return False
264-
265243
def _adjust_location(self):
266244
"""Automatically set spine bounds to the view interval."""
267245

lib/matplotlib/text.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,30 +1174,6 @@ def set_text(self, s):
11741174
self._text = str(s)
11751175
self.stale = True
11761176

1177-
@staticmethod
1178-
@cbook.deprecated("3.1")
1179-
def is_math_text(s, usetex=None):
1180-
"""
1181-
Returns a cleaned string and a boolean flag.
1182-
The flag indicates if the given string *s* contains any mathtext,
1183-
determined by counting unescaped dollar signs. If no mathtext
1184-
is present, the cleaned string has its dollar signs unescaped.
1185-
If usetex is on, the flag always has the value "TeX".
1186-
"""
1187-
# Did we find an even number of non-escaped dollar signs?
1188-
# If so, treat is as math text.
1189-
if usetex is None:
1190-
usetex = rcParams['text.usetex']
1191-
if usetex:
1192-
if s == ' ':
1193-
s = r'\ '
1194-
return s, 'TeX'
1195-
1196-
if cbook.is_math_text(s):
1197-
return s, True
1198-
else:
1199-
return s.replace(r'\$', '$'), False
1200-
12011177
def _preprocess_math(self, s):
12021178
"""
12031179
Return the string *s* after mathtext preprocessing, and the kind of

lib/matplotlib/textpath.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -453,36 +453,3 @@ def _revalidate_path(self):
453453
.translate(*self._xy))
454454
self._cached_vertices = tr.transform(self._vertices)
455455
self._invalid = False
456-
457-
@cbook.deprecated("3.1")
458-
def is_math_text(self, s):
459-
"""
460-
Returns True if the given string *s* contains any mathtext.
461-
"""
462-
# copied from Text.is_math_text -JJL
463-
464-
# Did we find an even number of non-escaped dollar signs?
465-
# If so, treat is as math text.
466-
dollar_count = s.count(r'$') - s.count(r'\$')
467-
even_dollars = (dollar_count > 0 and dollar_count % 2 == 0)
468-
469-
if rcParams['text.usetex']:
470-
return s, 'TeX'
471-
472-
if even_dollars:
473-
return s, True
474-
else:
475-
return s.replace(r'\$', '$'), False
476-
477-
@cbook.deprecated("3.1", alternative="TextPath")
478-
def text_get_vertices_codes(self, prop, s, usetex):
479-
"""
480-
Convert string *s* to a (vertices, codes) pair using font property
481-
*prop*.
482-
"""
483-
# Mostly copied from backend_svg.py.
484-
if usetex:
485-
return text_to_path.get_text_path(prop, s, usetex=True)
486-
else:
487-
clean_line, ismath = self.is_math_text(s)
488-
return text_to_path.get_text_path(prop, clean_line, ismath=ismath)

lib/matplotlib/widgets.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,11 +1821,6 @@ def _release(self, event):
18211821
self.pressv = None
18221822
return False
18231823

1824-
@cbook.deprecated("3.1")
1825-
@property
1826-
def buttonDown(self):
1827-
return False
1828-
18291824
def _onmove(self, event):
18301825
"""on motion notify event"""
18311826
if self.pressv is None:

0 commit comments

Comments
 (0)