41
41
42
42
import numpy as np
43
43
44
+ import matplotlib as mpl
44
45
from matplotlib import _api , rcParams
45
46
import matplotlib .axes as maxes
46
47
from matplotlib .path import Path
@@ -98,12 +99,15 @@ def get_tick_iterators(self, axes):
98
99
99
100
class _Base :
100
101
"""Base class for axis helper."""
101
- def __init__ (self ):
102
- self .delta1 , self .delta2 = 0.00001 , 0.00001
103
102
104
103
def update_lim (self , axes ):
105
104
pass
106
105
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
+
107
111
class Fixed (_Base ):
108
112
"""Helper class for a fixed (in the axes coordinate) axis."""
109
113
@@ -204,10 +208,7 @@ def __init__(self, axes, loc, nth_coord=None):
204
208
205
209
def get_tick_iterators (self , axes ):
206
210
"""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" ]:
211
212
angle_normal , angle_tangent = 90 , 0
212
213
else :
213
214
angle_normal , angle_tangent = 0 , 90
@@ -224,15 +225,12 @@ def get_tick_iterators(self, axes):
224
225
225
226
def _f (locs , labels ):
226
227
for x , l in zip (locs , labels ):
227
-
228
228
c = list (self .passthru_pt ) # copy
229
229
c [self .nth_coord ] = x
230
-
231
230
# check if the tick point is inside axes
232
231
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 ]):
236
234
yield c , angle_normal , angle_tangent , l
237
235
238
236
return _f (majorLocs , majorLabels ), _f (minorLocs , minorLabels )
@@ -303,10 +301,7 @@ def _f(locs, labels):
303
301
c = [self ._value , self ._value ]
304
302
c [self .nth_coord ] = x
305
303
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 :
310
305
yield c , angle_normal , angle_tangent , l
311
306
312
307
return _f (majorLocs , majorLabels ), _f (minorLocs , minorLabels )
0 commit comments