@@ -214,8 +214,16 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
214214 x0 , y0 = x , y
215215
216216 if nx1 is None :
217+ _api .warn_deprecated (
218+ "3.5" , message = "Support for passing nx1=None to mean nx+1 is "
219+ "deprecated since %(since)s; in a future version, nx1=None "
220+ "will mean 'up to the last cell'." )
217221 nx1 = nx + 1
218222 if ny1 is None :
223+ _api .warn_deprecated (
224+ "3.5" , message = "Support for passing ny1=None to mean ny+1 is "
225+ "deprecated since %(since)s; in a future version, ny1=None "
226+ "will mean 'up to the last cell'." )
219227 ny1 = ny + 1
220228
221229 x1 , w1 = x0 + ox [nx ] / fig_w , (ox [nx1 ] - ox [nx ]) / fig_w
@@ -237,7 +245,10 @@ def new_locator(self, nx, ny, nx1=None, ny1=None):
237245 ny, ny1 : int
238246 Same as *nx* and *nx1*, but for row positions.
239247 """
240- return AxesLocator (self , nx , ny , nx1 , ny1 )
248+ return AxesLocator (
249+ self , nx , ny ,
250+ nx1 if nx1 is not None else nx + 1 ,
251+ ny1 if ny1 is not None else ny + 1 )
241252
242253 def append_size (self , position , size ):
243254 if position == "left" :
@@ -267,9 +278,10 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
267278
268279class AxesLocator :
269280 """
270- A simple callable object, initialized with AxesDivider class,
271- returns the position and size of the given cell.
281+ A callable object which returns the position and size of a given
282+ AxesDivider cell.
272283 """
284+
273285 def __init__ (self , axes_divider , nx , ny , nx1 = None , ny1 = None ):
274286 """
275287 Parameters
@@ -291,8 +303,16 @@ def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
291303 self ._nx , self ._ny = nx - _xrefindex , ny - _yrefindex
292304
293305 if nx1 is None :
306+ _api .warn_deprecated (
307+ "3.5" , message = "Support for passing nx1=None to mean nx+1 is "
308+ "deprecated since %(since)s; in a future version, nx1=None "
309+ "will mean 'up to the last cell'." )
294310 nx1 = nx + 1
295311 if ny1 is None :
312+ _api .warn_deprecated (
313+ "3.5" , message = "Support for passing ny1=None to mean ny+1 is "
314+ "deprecated since %(since)s; in a future version, ny1=None "
315+ "will mean 'up to the last cell'." )
296316 ny1 = ny + 1
297317
298318 self ._nx1 = nx1 - _xrefindex
@@ -645,7 +665,7 @@ def new_locator(self, nx, nx1=None):
645665 specified. Otherwise location of columns spanning between *nx*
646666 to *nx1* (but excluding *nx1*-th column) is specified.
647667 """
648- return AxesLocator (self , nx , 0 , nx1 , None )
668+ return AxesLocator (self , nx , 0 , nx1 if nx1 is not None else nx + 1 , 1 )
649669
650670 def locate (self , nx , ny , nx1 = None , ny1 = None , axes = None , renderer = None ):
651671 # docstring inherited
@@ -656,6 +676,10 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
656676 x0 , y0 , ox , hh = _locate (
657677 x , y , w , h , summed_ws , equal_hs , fig_w , fig_h , self .get_anchor ())
658678 if nx1 is None :
679+ _api .warn_deprecated (
680+ "3.5" , message = "Support for passing nx1=None to mean nx+1 is "
681+ "deprecated since %(since)s; in a future version, nx1=None "
682+ "will mean 'up to the last cell'." )
659683 nx1 = nx + 1
660684 x1 , w1 = x0 + ox [nx ] / fig_w , (ox [nx1 ] - ox [nx ]) / fig_w
661685 y1 , h1 = y0 , hh
@@ -680,7 +704,7 @@ def new_locator(self, ny, ny1=None):
680704 specified. Otherwise location of rows spanning between *ny*
681705 to *ny1* (but excluding *ny1*-th row) is specified.
682706 """
683- return AxesLocator (self , 0 , ny , None , ny1 )
707+ return AxesLocator (self , 0 , ny , 1 , ny1 if ny1 is not None else ny + 1 )
684708
685709 def locate (self , nx , ny , nx1 = None , ny1 = None , axes = None , renderer = None ):
686710 # docstring inherited
@@ -691,6 +715,10 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
691715 y0 , x0 , oy , ww = _locate (
692716 y , x , h , w , summed_hs , equal_ws , fig_h , fig_w , self .get_anchor ())
693717 if ny1 is None :
718+ _api .warn_deprecated (
719+ "3.5" , message = "Support for passing ny1=None to mean ny+1 is "
720+ "deprecated since %(since)s; in a future version, ny1=None "
721+ "will mean 'up to the last cell'." )
694722 ny1 = ny + 1
695723 x1 , w1 = x0 , ww
696724 y1 , h1 = y0 + oy [ny ] / fig_h , (oy [ny1 ] - oy [ny ]) / fig_h
0 commit comments