From d2ab18dc4c6b63740908ef52a13a0a9a179878c6 Mon Sep 17 00:00:00 2001 From: Vinithkumar Alande <92010990+Vinith11@users.noreply.github.com> Date: Fri, 13 Oct 2023 11:07:50 +0530 Subject: [PATCH] Update contour.py In this series of changes, deprecated code marked with @_api.deprecated decorators has been systematically removed from the codebase. These deprecations have been addressed by eliminating the deprecated functions, methods, and properties. Where applicable, alternatives have been implemented to maintain the desired functionality. Additionally, related documentation, tests, type stubs, and exceptions have been updated or removed as needed to ensure code quality and consistency. --- lib/matplotlib/contour.py | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index dc5ed5d626bc..921ff911e744 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -25,7 +25,7 @@ import matplotlib.transforms as mtransforms -@_api.deprecated("3.7", alternative="Text.set_transform_rotates_text") + class ClabelText(Text): """ Unlike the ordinary text, the get_rotation returns an updated @@ -223,18 +223,6 @@ def clabel(self, levels=None, *, return cbook.silent_list('text.Text', self.labelTexts) - @_api.deprecated("3.7", alternative="cs.labelTexts[0].get_font()") - @property - def labelFontProps(self): - return self._label_font_props - - @_api.deprecated("3.7", alternative=( - "[cs.labelTexts[0].get_font().get_size()] * len(cs.labelLevelList)")) - @property - def labelFontSizeList(self): - return [self._label_font_props.get_size()] * len(self.labelLevelList) - - @_api.deprecated("3.7", alternative="cs.labelTexts") @property def labelTextsList(self): return cbook.silent_list('text.Text', self.labelTexts) @@ -260,7 +248,7 @@ def _get_nth_label_width(self, nth): figure=fig, fontproperties=self._label_font_props) .get_window_extent(renderer).width) - @_api.deprecated("3.7", alternative="Artist.set") + def set_label_props(self, label, text, color): """Set the label properties - color, fontsize, text.""" label.set_text(text) @@ -435,7 +423,7 @@ def interp_vec(x, xp, fp): return [np.interp(x, xp, col) for col in fp.T] return angle, Path(xys, codes) - @_api.deprecated("3.8") + def calc_label_rot_and_inline(self, slc, ind, lw, lc=None, spacing=5): """ Calculate the appropriate label rotation given the linecontour @@ -548,7 +536,7 @@ def add_label(self, x, y, rotation, lev, cvalue): # Add label to plot here - useful for manual mode label selection self.axes.add_artist(t) - @_api.deprecated("3.8", alternative="add_label") + def add_label_clabeltext(self, x, y, rotation, lev, cvalue): """Add contour label with `.Text.set_transform_rotates_text`.""" with cbook._setattr_cm(self, _use_clabeltext=True): @@ -942,8 +930,7 @@ def __init__(self, ax, *args, alpha = property(lambda self: self.get_alpha()) linestyles = property(lambda self: self._orig_linestyles) - @_api.deprecated("3.8", alternative="set_antialiased or get_antialiased", - addendum="Note that get_antialiased returns an array.") + @property def antialiased(self): return all(self.get_antialiased()) @@ -952,7 +939,7 @@ def antialiased(self): def antialiased(self, aa): self.set_antialiased(aa) - @_api.deprecated("3.8") + @property def collections(self): # On access, make oneself invisible and instead add the old-style collections @@ -1388,7 +1375,7 @@ def _find_nearest_contour(self, xy, indices=None): return idx_level_min, idx_vtx_min, proj_min - @_api.deprecated("3.8") + def find_nearest_contour(self, x, y, indices=None, pixel=True): """ Find the point in the contour plot that is closest to ``(x, y)``.