@@ -85,12 +85,16 @@ def __init__(self, grid_helper, nth_coord, value, axis_direction=None):
85
85
super ().__init__ (nth_coord , value )
86
86
self .value = value
87
87
self .grid_helper = grid_helper
88
- self ._extremes = None , None
88
+ self ._extremes = - np . inf , np . inf
89
89
90
90
self ._get_line_path = None # a method that returns a Path.
91
91
self ._line_num_points = 100 # number of points to create a line
92
92
93
93
def set_extremes (self , e1 , e2 ):
94
+ if e1 is None :
95
+ e1 = - np .inf
96
+ if e2 is None :
97
+ e2 = np .inf
94
98
self ._extremes = e1 , e2
95
99
96
100
def update_lim (self , axes ):
@@ -102,36 +106,31 @@ def update_lim(self, axes):
102
106
extremes = grid_finder .extreme_finder (grid_finder .inv_transform_xy ,
103
107
x1 , y1 , x2 , y2 )
104
108
105
- extremes = list ( extremes )
106
- e1 , e2 = self ._extremes # ranges of other coordinates
109
+ lon_min , lon_max , lat_min , lat_max = extremes
110
+ e_min , e_max = self ._extremes # ranges of other coordinates
107
111
if self .nth_coord == 0 :
108
- if e1 is not None :
109
- extremes [2 ] = max (e1 , extremes [2 ])
110
- if e2 is not None :
111
- extremes [3 ] = min (e2 , extremes [3 ])
112
+ lat_min = max (e_min , lat_min )
113
+ lat_max = min (e_max , lat_max )
112
114
elif self .nth_coord == 1 :
113
- if e1 is not None :
114
- extremes [0 ] = max (e1 , extremes [0 ])
115
- if e2 is not None :
116
- extremes [1 ] = min (e2 , extremes [1 ])
115
+ lon_min = max (e_min , lon_min )
116
+ lon_max = min (e_max , lon_max )
117
117
118
- lon_min , lon_max , lat_min , lat_max = extremes
119
118
lon_levs , lon_n , lon_factor = \
120
119
grid_finder .grid_locator1 (lon_min , lon_max )
121
120
lat_levs , lat_n , lat_factor = \
122
121
grid_finder .grid_locator2 (lat_min , lat_max )
123
122
124
123
if self .nth_coord == 0 :
125
- xx0 = np .linspace (self .value , self .value , self . _line_num_points )
126
- yy0 = np .linspace (extremes [ 2 ], extremes [ 3 ] , self ._line_num_points )
124
+ xx0 = np .full (self ._line_num_points , self .value )
125
+ yy0 = np .linspace (lat_min , lat_max , self ._line_num_points )
127
126
xx , yy = grid_finder .transform_xy (xx0 , yy0 )
128
127
elif self .nth_coord == 1 :
129
- xx0 = np .linspace (extremes [ 0 ], extremes [ 1 ] , self ._line_num_points )
130
- yy0 = np .linspace (self .value , self .value , self . _line_num_points )
128
+ xx0 = np .linspace (lon_min , lon_max , self ._line_num_points )
129
+ yy0 = np .full (self ._line_num_points , self .value )
131
130
xx , yy = grid_finder .transform_xy (xx0 , yy0 )
132
131
133
132
self .grid_info = {
134
- "extremes" : extremes ,
133
+ "extremes" : ( lon_min , lon_max , lat_min , lat_max ) ,
135
134
"lon_info" : (lon_levs , lon_n , _deprecate_factor_none (lon_factor )),
136
135
"lat_info" : (lat_levs , lat_n , _deprecate_factor_none (lat_factor )),
137
136
"lon_labels" : grid_finder .tick_formatter1 (
0 commit comments