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

Skip to content

Commit eab0f8d

Browse files
committed
Simplify shape check
1 parent 4665bd0 commit eab0f8d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/matplotlib/collections.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,15 +2054,10 @@ def __init__(self, *args, **kwargs):
20542054
# end of signature deprecation code
20552055

20562056
super().__init__(**kwargs)
2057+
_api.check_shape((None, None, 2), coordinates=coords)
20572058
self._coordinates = coords
2058-
shape = self._coordinates.shape
2059-
if (self._coordinates.ndim != 3 or shape[-1] != 2):
2060-
raise ValueError(
2061-
"coordinates must be a (N, M, 2) array-like, but got "
2062-
f"{shape}")
2063-
2064-
self._meshWidth = shape[1] - 1
2065-
self._meshHeight = shape[0] - 1
2059+
self._meshWidth = self._coordinates.shape[1] - 1
2060+
self._meshHeight = self._coordinates.shape[0] - 1
20662061
self._antialiased = antialiased
20672062
self._shading = shading
20682063

0 commit comments

Comments
 (0)