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

Skip to content

Remove more API deprecated in 3.1 #16772

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 10 additions & 2 deletions doc/api/next_api_changes/removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ Classes and methods
- ``scale.NaturalLogTransform`` (use ``scale.LogTransform`` instead)
- ``scale.InvertedNaturalLogTransform`` (use ``scale.InvertedLogTransform`` instead)

- ``spines.Spine.is_frame_like()`` (no replacement)

- ``text.Text.is_math_text()`` (use ``cbook.is_math_text()`` instead)
- ``text.TextWithDash()`` (use ``text.Annotation`` instead)
- ``textpath.TextPath.is_math_text()`` (use ``cbook.is_math_text()`` instead)
- ``textpath.TextPath.text_get_vertices_codes()``
(use ``textpath.text_to_path.get_text_path()`` instead)

- ``ticker.OldScalarFormatter.pprint_val()`` (no replacement)
- ``ticker.ScalarFormatter.pprint_val()`` (no replacement)
- ``ticker.LogFormatter.pprint_val()`` (no replacement)
Expand Down Expand Up @@ -112,8 +120,6 @@ Classes and methods
- ``path.get_paths_extents()``
(use ``path.get_path_collection_extents()`` instead)

- ``text.TextWithDash`` (use ``text.Annotation`` instead)

- ``mplot3d.proj3d.line2d()`` (no replacement)
- ``mplot3d.proj3d.line2d_dist()`` (no replacement)
- ``mplot3d.proj3d.line2d_seg_dist()`` (no replacement)
Expand Down Expand Up @@ -142,6 +148,8 @@ Classes and methods
- ``axisartist.axislines.Axes.AxisDict``
(use ``axis_grid1.mpl_axes.Axes.AxisDict`` instead)

- ``widgets.SpanSelector.buttonDown`` property (no replacement)

Arguments
~~~~~~~~~
- ``Axes.text()`` / ``pyplot.text()`` do not support the parameter ``withdash``
Expand Down
22 changes: 0 additions & 22 deletions lib/matplotlib/spines.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,28 +240,6 @@ def cla(self):
if self.axis is not None:
self.axis.cla()

@cbook.deprecated("3.1")
def is_frame_like(self):
"""Return True if directly on axes frame.

This is useful for determining if a spine is the edge of an
old style MPL plot. If so, this function will return True.
"""
self._ensure_position_is_set()
position = self._position
if isinstance(position, str):
if position == 'center':
position = ('axes', 0.5)
elif position == 'zero':
position = ('data', 0)
if len(position) != 2:
raise ValueError("position should be 2-tuple")
position_type, amount = position
if position_type == 'outward' and amount == 0:
return True
else:
return False

def _adjust_location(self):
"""Automatically set spine bounds to the view interval."""

Expand Down
24 changes: 0 additions & 24 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,30 +1174,6 @@ def set_text(self, s):
self._text = str(s)
self.stale = True

@staticmethod
@cbook.deprecated("3.1")
def is_math_text(s, usetex=None):
"""
Returns a cleaned string and a boolean flag.
The flag indicates if the given string *s* contains any mathtext,
determined by counting unescaped dollar signs. If no mathtext
is present, the cleaned string has its dollar signs unescaped.
If usetex is on, the flag always has the value "TeX".
"""
# Did we find an even number of non-escaped dollar signs?
# If so, treat is as math text.
if usetex is None:
usetex = rcParams['text.usetex']
if usetex:
if s == ' ':
s = r'\ '
return s, 'TeX'

if cbook.is_math_text(s):
return s, True
else:
return s.replace(r'\$', '$'), False

def _preprocess_math(self, s):
"""
Return the string *s* after mathtext preprocessing, and the kind of
Expand Down
33 changes: 0 additions & 33 deletions lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,36 +453,3 @@ def _revalidate_path(self):
.translate(*self._xy))
self._cached_vertices = tr.transform(self._vertices)
self._invalid = False

@cbook.deprecated("3.1")
def is_math_text(self, s):
"""
Returns True if the given string *s* contains any mathtext.
"""
# copied from Text.is_math_text -JJL

# Did we find an even number of non-escaped dollar signs?
# If so, treat is as math text.
dollar_count = s.count(r'$') - s.count(r'\$')
even_dollars = (dollar_count > 0 and dollar_count % 2 == 0)

if rcParams['text.usetex']:
return s, 'TeX'

if even_dollars:
return s, True
else:
return s.replace(r'\$', '$'), False

@cbook.deprecated("3.1", alternative="TextPath")
def text_get_vertices_codes(self, prop, s, usetex):
"""
Convert string *s* to a (vertices, codes) pair using font property
*prop*.
"""
# Mostly copied from backend_svg.py.
if usetex:
return text_to_path.get_text_path(prop, s, usetex=True)
else:
clean_line, ismath = self.is_math_text(s)
return text_to_path.get_text_path(prop, clean_line, ismath=ismath)
5 changes: 0 additions & 5 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,11 +1821,6 @@ def _release(self, event):
self.pressv = None
return False

@cbook.deprecated("3.1")
@property
def buttonDown(self):
return False

def _onmove(self, event):
"""on motion notify event"""
if self.pressv is None:
Expand Down