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

Skip to content

Commit e572dd5

Browse files
authored
Merge pull request #22097 from anntzer/icc
In mpl_toolkits, use the same floating point slop as for standard ticks.
2 parents 22b6b89 + fb18d95 commit e572dd5

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``AxisArtistHelper.delta1`` and ``AxisArtistHelper.delta2``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... are deprecated with no replacement.

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
import numpy as np
4343

44+
import matplotlib as mpl
4445
from matplotlib import _api, rcParams
4546
import matplotlib.axes as maxes
4647
from matplotlib.path import Path
@@ -98,12 +99,15 @@ def get_tick_iterators(self, axes):
9899

99100
class _Base:
100101
"""Base class for axis helper."""
101-
def __init__(self):
102-
self.delta1, self.delta2 = 0.00001, 0.00001
103102

104103
def update_lim(self, axes):
105104
pass
106105

106+
delta1 = _api.deprecated("3.6")(
107+
property(lambda self: 0.00001, lambda self, value: None))
108+
delta2 = _api.deprecated("3.6")(
109+
property(lambda self: 0.00001, lambda self, value: None))
110+
107111
class Fixed(_Base):
108112
"""Helper class for a fixed (in the axes coordinate) axis."""
109113

@@ -204,10 +208,7 @@ def __init__(self, axes, loc, nth_coord=None):
204208

205209
def get_tick_iterators(self, axes):
206210
"""tick_loc, tick_angle, tick_label"""
207-
208-
loc = self._loc
209-
210-
if loc in ["bottom", "top"]:
211+
if self._loc in ["bottom", "top"]:
211212
angle_normal, angle_tangent = 90, 0
212213
else:
213214
angle_normal, angle_tangent = 0, 90
@@ -224,15 +225,12 @@ def get_tick_iterators(self, axes):
224225

225226
def _f(locs, labels):
226227
for x, l in zip(locs, labels):
227-
228228
c = list(self.passthru_pt) # copy
229229
c[self.nth_coord] = x
230-
231230
# check if the tick point is inside axes
232231
c2 = tick_to_axes.transform(c)
233-
if (0 - self.delta1
234-
<= c2[self.nth_coord]
235-
<= 1 + self.delta2):
232+
if mpl.transforms._interval_contains_close(
233+
(0, 1), c2[self.nth_coord]):
236234
yield c, angle_normal, angle_tangent, l
237235

238236
return _f(majorLocs, majorLabels), _f(minorLocs, minorLabels)
@@ -303,10 +301,7 @@ def _f(locs, labels):
303301
c = [self._value, self._value]
304302
c[self.nth_coord] = x
305303
c1, c2 = data_to_axes.transform(c)
306-
if (0 <= c1 <= 1 and 0 <= c2 <= 1
307-
and 0 - self.delta1
308-
<= [c1, c2][self.nth_coord]
309-
<= 1 + self.delta2):
304+
if 0 <= c1 <= 1 and 0 <= c2 <= 1:
310305
yield c, angle_normal, angle_tangent, l
311306

312307
return _f(majorLocs, majorLabels), _f(minorLocs, minorLabels)

0 commit comments

Comments
 (0)