Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e602b0c

Browse filesBrowse files
committed
FIX: unit-convert pcolorargs before interpolating
1 parent 5b835ee commit e602b0c
Copy full SHA for e602b0c

File tree

Expand file treeCollapse file tree

1 file changed

+7
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-9
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+7-9Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5422,8 +5422,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
54225422
self.add_image(im)
54235423
return im
54245424

5425-
@staticmethod
5426-
def _pcolorargs(funcname, *args, shading='flat'):
5425+
def _pcolorargs(self, funcname, *args, shading='flat', **kwargs):
54275426
# - create X and Y if not present;
54285427
# - reshape X and Y as needed if they are 1-D;
54295428
# - check for proper sizes based on `shading` kwarg;
@@ -5454,6 +5453,9 @@ def _pcolorargs(funcname, *args, shading='flat'):
54545453
# Check x and y for bad data...
54555454
C = np.asanyarray(args[2])
54565455
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+
54575459
if funcname == 'pcolormesh':
54585460
if np.ma.is_masked(X) or np.ma.is_masked(Y):
54595461
raise ValueError(
@@ -5702,12 +5704,10 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
57025704
if shading is None:
57035705
shading = rcParams['pcolor.shading']
57045706
shading = shading.lower()
5705-
X, Y, C, shading = self._pcolorargs('pcolor', *args, shading=shading)
5707+
X, Y, C, shading = self._pcolorargs('pcolor', *args, shading=shading,
5708+
kwargs=kwargs)
57065709
Ny, Nx = X.shape
57075710

5708-
# unit conversion allows e.g. datetime objects as axis values
5709-
X, Y = self._process_unit_info([("x", X), ("y", Y)], kwargs)
5710-
57115711
# convert to MA, if necessary.
57125712
C = ma.asarray(C)
57135713
X = ma.asarray(X)
@@ -5976,12 +5976,10 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
59765976
kwargs.setdefault('edgecolors', 'None')
59775977

59785978
X, Y, C, shading = self._pcolorargs('pcolormesh', *args,
5979-
shading=shading)
5979+
shading=shading, kwargs=kwargs)
59805980
Ny, Nx = X.shape
59815981
X = X.ravel()
59825982
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)
59855983

59865984
# convert to one dimensional arrays
59875985
C = C.ravel()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.