@@ -19,10 +19,13 @@ def __call__(self, direction, factor, values):
19
19
20
20
21
21
class ModifiedExtremeFinderCycle (angle_helper .ExtremeFinderCycle ):
22
- '''Changed to allow only left hand-side polar grid'''
22
+ '''Changed to allow only left hand-side polar grid
23
+
24
+ https://matplotlib.org/_modules/mpl_toolkits/axisartist/angle_helper.html#ExtremeFinderCycle.__call__
25
+ '''
23
26
def __call__ (self , transform_xy , x1 , y1 , x2 , y2 ):
24
- x_ , y_ = np .linspace ( x1 , x2 , self . nx ), np . linspace ( y1 , y2 , self . ny )
25
- x , y = np .meshgrid ( x_ , y_ )
27
+ x , y = np .meshgrid (
28
+ np . linspace ( x1 , x2 , self . nx ), np .linspace ( y1 , y2 , self . ny ) )
26
29
lon , lat = transform_xy (np .ravel (x ), np .ravel (y ))
27
30
28
31
with np .errstate (invalid = 'ignore' ):
@@ -41,7 +44,25 @@ def __call__(self, transform_xy, x1, y1, x2, y2):
41
44
lat_min , lat_max = np .nanmin (lat ), np .nanmax (lat )
42
45
43
46
lon_min , lon_max , lat_min , lat_max = \
44
- self ._adjust_extremes (lon_min , lon_max , lat_min , lat_max )
47
+ self ._add_pad (lon_min , lon_max , lat_min , lat_max )
48
+
49
+ # check cycle
50
+ if self .lon_cycle :
51
+ lon_max = min (lon_max , lon_min + self .lon_cycle )
52
+ if self .lat_cycle :
53
+ lat_max = min (lat_max , lat_min + self .lat_cycle )
54
+
55
+ if self .lon_minmax is not None :
56
+ min0 = self .lon_minmax [0 ]
57
+ lon_min = max (min0 , lon_min )
58
+ max0 = self .lon_minmax [1 ]
59
+ lon_max = min (max0 , lon_max )
60
+
61
+ if self .lat_minmax is not None :
62
+ min0 = self .lat_minmax [0 ]
63
+ lat_min = max (min0 , lat_min )
64
+ max0 = self .lat_minmax [1 ]
65
+ lat_max = min (max0 , lat_max )
45
66
46
67
return lon_min , lon_max , lat_min , lat_max
47
68
0 commit comments