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 6ca36ef

Browse filesBrowse files
committed
Added broadcasting support in some mplot3d methods
1 parent 447a7cc commit 6ca36ef
Copy full SHA for 6ca36ef

File tree

Expand file treeCollapse file tree

1 file changed

+3
-15
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-15
lines changed

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+3-15Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,15 +1352,9 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
13521352
had_data = self.has_data()
13531353

13541354
Z = np.atleast_2d(Z)
1355-
rows, cols = Z.shape
13561355
# TODO: Support masked arrays
1357-
X = np.asarray(X)
1358-
Y = np.asarray(Y)
1359-
# Force X and Y to take the same shape.
1360-
# If they can not be fitted to that shape,
1361-
# then an exception is automatically thrown.
1362-
X.shape = (rows, cols)
1363-
Y.shape = (rows, cols)
1356+
X, Y, Z = np.broadcast_arrays(X, Y, Z)
1357+
rows, cols = Z.shape
13641358

13651359
rstride = kwargs.pop('rstride', 10)
13661360
cstride = kwargs.pop('cstride', 10)
@@ -1526,14 +1520,8 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
15261520
had_data = self.has_data()
15271521
Z = np.atleast_2d(Z)
15281522
# FIXME: Support masked arrays
1529-
X = np.asarray(X)
1530-
Y = np.asarray(Y)
1523+
X, Y, Z = np.broadcast_arrays(X, Y, Z)
15311524
rows, cols = Z.shape
1532-
# Force X and Y to take the same shape.
1533-
# If they can not be fitted to that shape,
1534-
# then an exception is automatically thrown.
1535-
X.shape = (rows, cols)
1536-
Y.shape = (rows, cols)
15371525

15381526
# We want two sets of lines, one running along the "rows" of
15391527
# Z and another set of lines running along the "columns" of Z.

0 commit comments

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