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

Skip to content

Commit f3abf3b

Browse files
authored
Merge pull request #27300 from anntzer/gti
Remove idiosyncratic get_tick_iterator API.
2 parents 3ffd6cc + dd00bde commit f3abf3b

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``GridHelperCurveLinear.get_tick_iterator``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... is deprecated with no replacement.

lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
import functools
6-
from itertools import chain
76

87
import numpy as np
98

@@ -76,10 +75,18 @@ def get_tick_iterators(self, axes):
7675
"top": "bottom", "bottom": "top"}[self.side]
7776
else:
7877
side = self.side
79-
g = self.grid_helper
80-
ti1 = g.get_tick_iterator(self.nth_coord_ticks, side)
81-
ti2 = g.get_tick_iterator(1-self.nth_coord_ticks, side, minor=True)
82-
return chain(ti1, ti2), iter([])
78+
79+
angle_tangent = dict(left=90, right=90, bottom=0, top=0)[side]
80+
81+
def iter_major():
82+
for nth_coord, show_labels in [
83+
(self.nth_coord_ticks, True), (1 - self.nth_coord_ticks, False)]:
84+
gi = self.grid_helper._grid_info[["lon", "lat"][nth_coord]]
85+
for (xy, angle_normal), l in zip(
86+
gi["tick_locs"][side], gi["tick_labels"][side]):
87+
yield xy, angle_normal, angle_tangent, (l if show_labels else "")
88+
89+
return iter_major(), iter([])
8390

8491

8592
class FloatingAxisArtistHelper(_FloatingAxisArtistHelperBase):
@@ -211,14 +218,14 @@ def trf_xy(x, y):
211218
in_01 = functools.partial(
212219
mpl.transforms._interval_contains_close, (0, 1))
213220

214-
def f1():
221+
def iter_major():
215222
for x, y, normal, tangent, lab \
216223
in zip(xx1, yy1, angle_normal, angle_tangent, labels):
217224
c2 = tick_to_axes.transform((x, y))
218225
if in_01(c2[0]) and in_01(c2[1]):
219226
yield [x, y], *np.rad2deg([normal, tangent]), lab
220227

221-
return f1(), iter([])
228+
return iter_major(), iter([])
222229

223230
def get_line_transform(self, axes):
224231
return axes.transData
@@ -309,6 +316,7 @@ def get_gridlines(self, which="major", axis="both"):
309316
grid_lines.extend(gl)
310317
return grid_lines
311318

319+
@_api.deprecated("3.9")
312320
def get_tick_iterator(self, nth_coord, axis_side, minor=False):
313321
angle_tangent = dict(left=90, right=90, bottom=0, top=0)[axis_side]
314322
lon_or_lat = ["lon", "lat"][nth_coord]

0 commit comments

Comments
 (0)