Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added broadcasting support in some mplot3d methods #1074

Merged
merged 1 commit into from Aug 17, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 3 additions & 15 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Expand Up @@ -1352,15 +1352,9 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
had_data = self.has_data() had_data = self.has_data()


Z = np.atleast_2d(Z) Z = np.atleast_2d(Z)
rows, cols = Z.shape
# TODO: Support masked arrays # TODO: Support masked arrays
X = np.asarray(X) X, Y, Z = np.broadcast_arrays(X, Y, Z)
Y = np.asarray(Y) rows, cols = Z.shape
# Force X and Y to take the same shape.
# If they can not be fitted to that shape,
# then an exception is automatically thrown.
X.shape = (rows, cols)
Y.shape = (rows, cols)


rstride = kwargs.pop('rstride', 10) rstride = kwargs.pop('rstride', 10)
cstride = kwargs.pop('cstride', 10) cstride = kwargs.pop('cstride', 10)
Expand Down Expand Up @@ -1526,14 +1520,8 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
had_data = self.has_data() had_data = self.has_data()
Z = np.atleast_2d(Z) Z = np.atleast_2d(Z)
# FIXME: Support masked arrays # FIXME: Support masked arrays
X = np.asarray(X) X, Y, Z = np.broadcast_arrays(X, Y, Z)
Y = np.asarray(Y)
rows, cols = Z.shape rows, cols = Z.shape
# Force X and Y to take the same shape.
# If they can not be fitted to that shape,
# then an exception is automatically thrown.
X.shape = (rows, cols)
Y.shape = (rows, cols)


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