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

Skip to content

Commit e577962

Browse files
authored
Merge pull request #25427 from anntzer/unex
Store FloatingAxes "extremes" info in fewer places.
2 parents 73394f2 + 46a853f commit e577962

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``GridHelperCurveLinear.get_data_boundary``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... is deprecated. Use ``grid_finder.extreme_finder(*[None] * 5)`` to get the
4+
extremes of the grid.

lib/mpl_toolkits/axisartist/floating_axes.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def __init__(self, grid_helper, side, nth_coord_ticks=None):
3333
nth_coord = along which coordinate value varies.
3434
nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
3535
"""
36-
value, nth_coord = grid_helper.get_data_boundary(side)
36+
lon1, lon2, lat1, lat2 = grid_helper.grid_finder.extreme_finder(*[None] * 5)
37+
value, nth_coord = _api.check_getitem(
38+
dict(left=(lon1, 0), right=(lon2, 0), bottom=(lat1, 1), top=(lat2, 1)),
39+
side=side)
3740
super().__init__(grid_helper, nth_coord, value, axis_direction=side)
3841
if nth_coord_ticks is None:
3942
nth_coord_ticks = nth_coord
@@ -58,7 +61,7 @@ def get_tick_iterators(self, axes):
5861
lon_levs, lon_n, lon_factor = self._grid_info["lon_info"]
5962
xx0 = lon_levs / lon_factor
6063

61-
extremes = self.grid_helper._extremes
64+
extremes = self.grid_helper.grid_finder.extreme_finder(*[None] * 5)
6265
xmin, xmax = sorted(extremes[:2])
6366
ymin, ymax = sorted(extremes[2:])
6467

@@ -137,20 +140,19 @@ def __init__(self, aux_trans, extremes,
137140
tick_formatter1=None,
138141
tick_formatter2=None):
139142
# docstring inherited
140-
self._extremes = extremes
141-
extreme_finder = ExtremeFinderFixed(extremes)
142143
super().__init__(aux_trans,
143-
extreme_finder,
144+
extreme_finder=ExtremeFinderFixed(extremes),
144145
grid_locator1=grid_locator1,
145146
grid_locator2=grid_locator2,
146147
tick_formatter1=tick_formatter1,
147148
tick_formatter2=tick_formatter2)
148149

150+
@_api.deprecated("3.8")
149151
def get_data_boundary(self, side):
150152
"""
151153
Return v=0, nth=1.
152154
"""
153-
lon1, lon2, lat1, lat2 = self._extremes
155+
lon1, lon2, lat1, lat2 = self.grid_finder.extreme_finder(*[None] * 5)
154156
return dict(left=(lon1, 0),
155157
right=(lon2, 0),
156158
bottom=(lat1, 1),
@@ -262,10 +264,7 @@ def __init__(self, *args, grid_helper, **kwargs):
262264

263265
def _gen_axes_patch(self):
264266
# docstring inherited
265-
# Using a public API to access _extremes.
266-
(x0, _), (x1, _), (y0, _), (y1, _) = map(
267-
self.get_grid_helper().get_data_boundary,
268-
["left", "right", "bottom", "top"])
267+
x0, x1, y0, y1 = self.get_grid_helper().grid_finder.extreme_finder(*[None] * 5)
269268
patch = mpatches.Polygon([(x0, y0), (x1, y0), (x1, y1), (x0, y1)])
270269
patch.get_path()._interpolation_steps = 100
271270
return patch

0 commit comments

Comments
 (0)