@@ -5422,8 +5422,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
5422
5422
self .add_image (im )
5423
5423
return im
5424
5424
5425
- @staticmethod
5426
- def _pcolorargs (funcname , * args , shading = 'flat' ):
5425
+ def _pcolorargs (self , funcname , * args , shading = 'flat' , ** kwargs ):
5427
5426
# - create X and Y if not present;
5428
5427
# - reshape X and Y as needed if they are 1-D;
5429
5428
# - check for proper sizes based on `shading` kwarg;
@@ -5454,6 +5453,11 @@ def _pcolorargs(funcname, *args, shading='flat'):
5454
5453
# Check x and y for bad data...
5455
5454
C = np .asanyarray (args [2 ])
5456
5455
X , Y = [cbook .safe_masked_invalid (a ) for a in args [:2 ]]
5456
+ # unit conversion allows e.g. datetime objects as axis values
5457
+ X , Y = self ._process_unit_info ([("x" , X ), ("y" , Y )], kwargs )
5458
+ X = self .convert_xunits (X )
5459
+ Y = self .convert_yunits (Y )
5460
+
5457
5461
if funcname == 'pcolormesh' :
5458
5462
if np .ma .is_masked (X ) or np .ma .is_masked (Y ):
5459
5463
raise ValueError (
@@ -5702,12 +5706,10 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
5702
5706
if shading is None :
5703
5707
shading = rcParams ['pcolor.shading' ]
5704
5708
shading = shading .lower ()
5705
- X , Y , C , shading = self ._pcolorargs ('pcolor' , * args , shading = shading )
5709
+ X , Y , C , shading = self ._pcolorargs ('pcolor' , * args , shading = shading ,
5710
+ kwargs )
5706
5711
Ny , Nx = X .shape
5707
5712
5708
- # unit conversion allows e.g. datetime objects as axis values
5709
- X , Y = self ._process_unit_info ([("x" , X ), ("y" , Y )], kwargs )
5710
-
5711
5713
# convert to MA, if necessary.
5712
5714
C = ma .asarray (C )
5713
5715
X = ma .asarray (X )
@@ -5976,12 +5978,10 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
5976
5978
kwargs .setdefault ('edgecolors' , 'None' )
5977
5979
5978
5980
X , Y , C , shading = self ._pcolorargs ('pcolormesh' , * args ,
5979
- shading = shading )
5981
+ shading = shading , kwargs )
5980
5982
Ny , Nx = X .shape
5981
5983
X = X .ravel ()
5982
5984
Y = Y .ravel ()
5983
- # unit conversion allows e.g. datetime objects as axis values
5984
- X , Y = self ._process_unit_info ([("x" , X ), ("y" , Y )], kwargs )
5985
5985
5986
5986
# convert to one dimensional arrays
5987
5987
C = C .ravel ()
0 commit comments