@@ -1264,13 +1264,16 @@ def add_subplot(self, *args, **kwargs):
1264
1264
1265
1265
Parameters
1266
1266
----------
1267
- *args, int or (int, int, int) or `SubplotSpec`, default: (1, 1, 1)
1267
+ *args, int, (int, int, *index*), or `SubplotSpec`, default: (1, 1, 1)
1268
1268
The position of the subplot described by one of
1269
1269
1270
1270
- Three integers (*nrows*, *ncols*, *index*). The subplot will
1271
1271
take the *index* position on a grid with *nrows* rows and
1272
1272
*ncols* columns. *index* starts at 1 in the upper left corner
1273
- and increases to the right.
1273
+ and increases to the right. *index* can also be a two-tuple
1274
+ sepcifying the (*start*, *stop*) indices of the subplot. i.e.
1275
+ ``fig.add_subplot(3, 1, (1, 2))`` makes a subplot that spans the
1276
+ upper 2/3 of the figure.
1274
1277
- A 3-digit integer. The digits are interpreted as if given
1275
1278
separately as three single-digit integers, i.e.
1276
1279
``fig.add_subplot(235)`` is the same as
@@ -1378,18 +1381,18 @@ def add_subplot(self, *args, **kwargs):
1378
1381
'position specification.' )
1379
1382
elif nargs == 3 :
1380
1383
newarg = [None ] * 3
1381
- message = ("Passing non-integers as three-element "
1382
- "position specification is deprecated since "
1383
- "%(since)s and will be removed %(removal)s." )
1384
+ message = ("Passing non-integers as three-element "
1385
+ "position specification is deprecated since "
1386
+ "%(since)s and will be removed %(removal)s." )
1384
1387
for nn , arg in enumerate (args [:2 ]):
1385
1388
if not isinstance (arg , Integral ):
1386
- cbook .warn_deprecated ("3.3" , message )
1389
+ cbook .warn_deprecated ("3.3" , message = message )
1387
1390
newarg [nn ] = int (arg )
1388
1391
if isinstance (args [2 ], tuple ):
1389
1392
# start/stop two-tuple is allowed...
1390
1393
for arg in args [2 ]:
1391
1394
if not isinstance (arg , Integral ):
1392
- cbook .warn_deprecated ("3.3" , message )
1395
+ cbook .warn_deprecated ("3.3" , message = mesage )
1393
1396
newarg [nn ] = (int (args [0 ]), int (args [1 ]))
1394
1397
else :
1395
1398
newarg [nn ] = int (arg )
0 commit comments