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

Skip to content

Fix positional/kwarg handling of the Z argument #2851

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

Merged
merged 1 commit into from
Mar 8, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1827,12 +1827,17 @@ def plot_trisurf(self, *args, **kwargs):
lightsource = kwargs.pop('lightsource', None)

tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)
z = np.asarray(args[0])
if 'Z' in kwargs:
z = np.asarray(kwargs.pop('Z'))
else:
z = np.asarray(args[0])
# We do this so Z doesn't get passed as an arg to PolyCollection
args = args[1:]

triangles = tri.get_masked_triangles()
xt = tri.x[triangles][...,np.newaxis]
yt = tri.y[triangles][...,np.newaxis]
zt = np.array(z)[triangles][...,np.newaxis]
xt = tri.x[triangles][..., np.newaxis]
yt = tri.y[triangles][..., np.newaxis]
zt = z[triangles][..., np.newaxis]

verts = np.concatenate((xt, yt, zt), axis=2)

Expand Down Expand Up @@ -2024,10 +2029,12 @@ def tricontour(self, *args, **kwargs):
*args, **kwargs)
X = tri.x
Y = tri.y
Z = args[0]

# We do this so Z doesn't get passed as an arg to Axes.tricontour
args = args[1:]
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontour
args = args[1:]

jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
Expand Down Expand Up @@ -2109,10 +2116,12 @@ def tricontourf(self, *args, **kwargs):
*args, **kwargs)
X = tri.x
Y = tri.y
Z = args[0]

# We do this so Z doesn't get passed as an arg to Axes.tricontour
args = args[1:]
if 'Z' in kwargs:
Z = kwargs.pop('Z')
else:
Z = args[0]
# We do this so Z doesn't get passed as an arg to Axes.tricontourf
args = args[1:]

jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
Expand Down