From 79fc9e581f1dc00f90cb41d63425766c575c62c7 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 12 Jul 2021 19:29:29 +0200 Subject: [PATCH] Small simplifications to FixedAxisArtistHelper. - change_tick_coords has never been used by any other function or in any example in the library's history, and is a custom API not even present on other AxisArtistHelpers, so deprecate it. - _limits_inverted is only used in get_tick_iterators, so one can just test limits inversion there instead of carrying one bit of state around. --- .../deprecations/20638-AL.rst | 3 +++ .../axisartist/grid_helper_curvelinear.py | 21 ++++--------------- 2 files changed, 7 insertions(+), 17 deletions(-) create mode 100644 doc/api/next_api_changes/deprecations/20638-AL.rst diff --git a/doc/api/next_api_changes/deprecations/20638-AL.rst b/doc/api/next_api_changes/deprecations/20638-AL.rst new file mode 100644 index 000000000000..cd9f5f738eb2 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/20638-AL.rst @@ -0,0 +1,3 @@ +``FixedAxisArtistHelper.change_tick_coord`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated with no replacement. diff --git a/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py b/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py index 8ae8c0f0e0cb..21427fa7fcdd 100644 --- a/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py +++ b/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py @@ -32,21 +32,11 @@ def __init__(self, grid_helper, side, nth_coord_ticks=None): self.nth_coord_ticks = nth_coord_ticks self.side = side - self._limits_inverted = False def update_lim(self, axes): self.grid_helper.update_lim(axes) - if self.nth_coord == 0: - xy1, xy2 = axes.get_ylim() - else: - xy1, xy2 = axes.get_xlim() - - if xy1 > xy2: - self._limits_inverted = True - else: - self._limits_inverted = False - + @_api.deprecated("3.5") def change_tick_coord(self, coord_number=None): if coord_number is None: self.nth_coord_ticks = 1 - self.nth_coord_ticks @@ -60,18 +50,15 @@ def get_tick_transform(self, axes): def get_tick_iterators(self, axes): """tick_loc, tick_angle, tick_label""" - - g = self.grid_helper - - if self._limits_inverted: + v1, v2 = axes.get_ylim() if self.nth_coord == 0 else axes.get_xlim() + if v1 > v2: # Inverted limits. side = {"left": "right", "right": "left", "top": "bottom", "bottom": "top"}[self.side] else: side = self.side - + g = self.grid_helper ti1 = g.get_tick_iterator(self.nth_coord_ticks, side) ti2 = g.get_tick_iterator(1-self.nth_coord_ticks, side, minor=True) - return chain(ti1, ti2), iter([]) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy