FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

plot_surface now supports any array-like input. Closes #181 by WeatherGod · Pull Request #394 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
19 changes: 15 additions & 4 deletions lib/mpl_toolkits/mplot3d/axes3d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
============= ================================================
Argument Description
============= ================================================
*X*, *Y*, *Z* Data values as numpy.arrays
*X*, *Y*, *Z* Data values as 2D arrays
*rstride* Array row stride (step size)
*cstride* Array column stride (step size)
*color* Color of the surface patches
Expand All @@ -1334,7 +1334,17 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):

had_data = self.has_data()

Z = np.atleast_2d(Z)
rows, cols = Z.shape
# TODO: Support masked arrays
X = np.asarray(X)
Y = np.asarray(Y)
# 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)
cstride = kwargs.pop('cstride', 10)

Expand Down Expand Up @@ -1481,7 +1491,7 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
========== ================================================
Argument Description
========== ================================================
*X*, *Y*, Data values as numpy.arrays
*X*, *Y*, Data values as 2D arrays
*Z*
*rstride* Array row stride (step size)
*cstride* Array column stride (step size)
Expand Down Expand Up @@ -1735,8 +1745,6 @@ def tricontourf(self, X, Y, Z, offset=None, zdir='z', *args, **kwargs):
========== ================================================
*X*, *Y*, Data values as numpy.arrays
*Z*
*extend3d* Whether to extend contour in 3D (default: False)
*stride* Stride (step size) for extending contour
*zdir* The direction to use: x, y or z (default)
*offset* If specified plot a projection of the contour
lines on this position in plane normal to zdir
Expand All @@ -1749,9 +1757,12 @@ def tricontourf(self, X, Y, Z, offset=None, zdir='z', *args, **kwargs):

.. versionadded :: 1.1.0
'''
zdir = kwargs.pop('zdir', 'z')
offset = kwargs.pop('offset', None)

had_data = self.has_data()

jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
cset = Axes.tricontourf(self, X, Y, Z, *args, **kwargs)
self.add_contourf_set(cset, zdir, offset)

Expand Down

Back | FazBrowse Home | New Git URL