@@ -7316,13 +7316,33 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
7316
7316
7317
7317
return im
7318
7318
7319
- def _pcolorargs (self , funcname , * args , ** kw ):
7319
+ @staticmethod
7320
+ def _pcolorargs (funcname , * args , ** kw ):
7321
+ # This takes one kwarg, allmatch.
7322
+ # If allmatch is True, then the incoming X, Y, C must
7323
+ # have matching dimensions, taking into account that
7324
+ # X and Y can be 1-D rather than 2-D. This perfect
7325
+ # match is required for Gouroud shading. For flat
7326
+ # shading, X and Y specify boundaries, so we need
7327
+ # one more boundary than color in each direction.
7328
+ # For convenience, and consistent with Matlab, we
7329
+ # discard the last row and/or column of C if necessary
7330
+ # to meet this condition. This is done if allmatch
7331
+ # is False.
7332
+
7320
7333
allmatch = kw .pop ("allmatch" , False )
7334
+
7321
7335
if len (args ) == 1 :
7322
7336
C = args [0 ]
7323
7337
numRows , numCols = C .shape
7324
- X , Y = np .meshgrid (np .arange (numCols + 1 ), np .arange (numRows + 1 ))
7325
- elif len (args ) == 3 :
7338
+ if allmatch :
7339
+ X , Y = np .meshgrid (np .arange (numCols ), np .arange (numRows ))
7340
+ else :
7341
+ X , Y = np .meshgrid (np .arange (numCols + 1 ),
7342
+ np .arange (numRows + 1 ))
7343
+ return X , Y , C
7344
+
7345
+ if len (args ) == 3 :
7326
7346
X , Y , C = args
7327
7347
numRows , numCols = C .shape
7328
7348
else :
0 commit comments