@@ -222,8 +222,16 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
222222 x0 , y0 = x , y
223223
224224 if nx1 is None :
225+ _api .warn_deprecated (
226+ "3.5" , message = "Support for passing nx1=None to mean nx+1 is "
227+ "deprecated since %(since)s; in a future version, nx1=None "
228+ "will mean 'up to the last cell'." )
225229 nx1 = nx + 1
226230 if ny1 is None :
231+ _api .warn_deprecated (
232+ "3.5" , message = "Support for passing ny1=None to mean ny+1 is "
233+ "deprecated since %(since)s; in a future version, ny1=None "
234+ "will mean 'up to the last cell'." )
227235 ny1 = ny + 1
228236
229237 x1 , w1 = x0 + ox [nx ] / figW , (ox [nx1 ] - ox [nx ]) / figW
@@ -245,7 +253,10 @@ def new_locator(self, nx, ny, nx1=None, ny1=None):
245253 ny, ny1 : int
246254 Same as *nx* and *nx1*, but for row positions.
247255 """
248- return AxesLocator (self , nx , ny , nx1 , ny1 )
256+ return AxesLocator (
257+ self , nx , ny ,
258+ nx1 if nx1 is not None else nx + 1 ,
259+ ny1 if ny1 is not None else ny + 1 )
249260
250261 def append_size (self , position , size ):
251262 if position == "left" :
@@ -275,9 +286,10 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
275286
276287class AxesLocator :
277288 """
278- A simple callable object, initialized with AxesDivider class,
279- returns the position and size of the given cell.
289+ A callable object which returns the position and size of a given
290+ AxesDivider cell.
280291 """
292+
281293 def __init__ (self , axes_divider , nx , ny , nx1 = None , ny1 = None ):
282294 """
283295 Parameters
@@ -299,8 +311,16 @@ def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
299311 self ._nx , self ._ny = nx - _xrefindex , ny - _yrefindex
300312
301313 if nx1 is None :
314+ _api .warn_deprecated (
315+ "3.5" , message = "Support for passing nx1=None to mean nx+1 is "
316+ "deprecated since %(since)s; in a future version, nx1=None "
317+ "will mean 'up to the last cell'." )
302318 nx1 = nx + 1
303319 if ny1 is None :
320+ _api .warn_deprecated (
321+ "3.5" , message = "Support for passing ny1=None to mean ny+1 is "
322+ "deprecated since %(since)s; in a future version, ny1=None "
323+ "will mean 'up to the last cell'." )
304324 ny1 = ny + 1
305325
306326 self ._nx1 = nx1 - _xrefindex
@@ -629,7 +649,7 @@ def new_locator(self, nx, nx1=None):
629649 specified. Otherwise location of columns spanning between *nx*
630650 to *nx1* (but excluding *nx1*-th column) is specified.
631651 """
632- return AxesLocator (self , nx , 0 , nx1 , None )
652+ return AxesLocator (self , nx , 0 , nx1 if nx1 is not None else nx + 1 , 1 )
633653
634654 def _locate (self , x , y , w , h ,
635655 y_equivalent_sizes , x_appended_sizes ,
@@ -666,6 +686,10 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
666686 y_equivalent_sizes , x_appended_sizes ,
667687 figW , figH )
668688 if nx1 is None :
689+ _api .warn_deprecated (
690+ "3.5" , message = "Support for passing nx1=None to mean nx+1 is "
691+ "deprecated since %(since)s; in a future version, nx1=None "
692+ "will mean 'up to the last cell'." )
669693 nx1 = nx + 1
670694
671695 x1 , w1 = x0 + ox [nx ] / figW , (ox [nx1 ] - ox [nx ]) / figW
@@ -691,7 +715,7 @@ def new_locator(self, ny, ny1=None):
691715 specified. Otherwise location of rows spanning between *ny*
692716 to *ny1* (but excluding *ny1*-th row) is specified.
693717 """
694- return AxesLocator (self , 0 , ny , None , ny1 )
718+ return AxesLocator (self , 0 , ny , 1 , ny1 if ny1 is not None else ny + 1 )
695719
696720 def locate (self , nx , ny , nx1 = None , ny1 = None , axes = None , renderer = None ):
697721 # docstring inherited
@@ -704,6 +728,10 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
704728 x_equivalent_sizes , y_appended_sizes ,
705729 figH , figW )
706730 if ny1 is None :
731+ _api .warn_deprecated (
732+ "3.5" , message = "Support for passing ny1=None to mean ny+1 is "
733+ "deprecated since %(since)s; in a future version, ny1=None "
734+ "will mean 'up to the last cell'." )
707735 ny1 = ny + 1
708736
709737 x1 , w1 = x0 , ww
0 commit comments