Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82eca12

Browse files
authored
Merge pull request #15204 from anntzer/nrowsncols
PEP8ify some variable names.
2 parents 84e531b + c93c46e commit 82eca12

File tree

3 files changed

+30
-26
lines changed

3 files changed

+30
-26
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5634,12 +5634,11 @@ def _pcolorargs(funcname, *args, allmatch=False):
56345634

56355635
if len(args) == 1:
56365636
C = np.asanyarray(args[0])
5637-
numRows, numCols = C.shape
5637+
nrows, ncols = C.shape
56385638
if allmatch:
5639-
X, Y = np.meshgrid(np.arange(numCols), np.arange(numRows))
5639+
X, Y = np.meshgrid(np.arange(ncols), np.arange(nrows))
56405640
else:
5641-
X, Y = np.meshgrid(np.arange(numCols + 1),
5642-
np.arange(numRows + 1))
5641+
X, Y = np.meshgrid(np.arange(ncols + 1), np.arange(nrows + 1))
56435642
C = cbook.safe_masked_invalid(C)
56445643
return X, Y, C
56455644

@@ -5659,7 +5658,7 @@ def _pcolorargs(funcname, *args, allmatch=False):
56595658
X = X.data # strip mask as downstream doesn't like it...
56605659
if isinstance(Y, np.ma.core.MaskedArray):
56615660
Y = Y.data
5662-
numRows, numCols = C.shape
5661+
nrows, ncols = C.shape
56635662
else:
56645663
raise TypeError(
56655664
'Illegal arguments to %s; see help(%s)' % (funcname, funcname))
@@ -5677,12 +5676,12 @@ def _pcolorargs(funcname, *args, allmatch=False):
56775676
'Incompatible X, Y inputs to %s; see help(%s)' % (
56785677
funcname, funcname))
56795678
if allmatch:
5680-
if (Nx, Ny) != (numCols, numRows):
5679+
if (Nx, Ny) != (ncols, nrows):
56815680
raise TypeError('Dimensions of C %s are incompatible with'
56825681
' X (%d) and/or Y (%d); see help(%s)' % (
56835682
C.shape, Nx, Ny, funcname))
56845683
else:
5685-
if not (numCols in (Nx, Nx - 1) and numRows in (Ny, Ny - 1)):
5684+
if not (ncols in (Nx, Nx - 1) and nrows in (Ny, Ny - 1)):
56865685
raise TypeError('Dimensions of C %s are incompatible with'
56875686
' X (%d) and/or Y (%d); see help(%s)' % (
56885687
C.shape, Nx, Ny, funcname))

lib/matplotlib/axes/_subplots.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ class SubplotBase:
1717

1818
def __init__(self, fig, *args, **kwargs):
1919
"""
20-
*fig* is a :class:`matplotlib.figure.Figure` instance.
21-
22-
*args* is the tuple (*numRows*, *numCols*, *plotNum*), where
23-
the array of subplots in the figure has dimensions *numRows*,
24-
*numCols*, and where *plotNum* is the number of the subplot
25-
being created. *plotNum* starts at 1 in the upper left
26-
corner and increases to the right.
27-
28-
If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
29-
decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.
20+
Parameters
21+
----------
22+
fig : `matplotlib.figure.Figure`
23+
24+
*args : tuple (*nrows*, *ncols*, *index*) or int
25+
The array of subplots in the figure has dimensions ``(nrows,
26+
ncols)``, and *index* is the index of the subplot being created.
27+
*index* starts at 1 in the upper left corner and increases to the
28+
right.
29+
30+
If *nrows*, *ncols*, and *index* are all single digit numbers, then
31+
*args* can be passed as a single 3-digit number (e.g. 234 for
32+
(2, 3, 4)).
3033
"""
3134

3235
self.figure = fig

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,17 @@ def __init__(self, fig, *args, horizontal=None, vertical=None,
350350
"""
351351
Parameters
352352
----------
353-
fig : :class:`matplotlib.figure.Figure`
354-
*args : tuple (*numRows*, *numCols*, *plotNum*)
355-
The array of subplots in the figure has dimensions *numRows*,
356-
*numCols*, and *plotNum* is the number of the subplot
357-
being created. *plotNum* starts at 1 in the upper left
358-
corner and increases to the right.
359-
360-
If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
361-
decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.
353+
fig : `matplotlib.figure.Figure`
354+
355+
*args : tuple (*nrows*, *ncols*, *index*) or int
356+
The array of subplots in the figure has dimensions ``(nrows,
357+
ncols)``, and *index* is the index of the subplot being created.
358+
*index* starts at 1 in the upper left corner and increases to the
359+
right.
360+
361+
If *nrows*, *ncols*, and *index* are all single digit numbers, then
362+
*args* can be passed as a single 3-digit number (e.g. 234 for
363+
(2, 3, 4)).
362364
"""
363365

364366
self.figure = fig

0 commit comments

Comments
 (0)