Skip to content

Commit e955f56

Browse files
committed
Address some review comments
1 parent a5c2bd5 commit e955f56

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def path_to_3d_segment(path, zs=0, zdir='z'):
167167
# Pre allocate memory
168168
seg3d = np.ones((3, len(path)))
169169

170-
# Works either if zs is array or scalar
171-
seg3d[2] *= zs
170+
# Works both if zs is and array and a scalar
171+
seg3d[2, :] *= zs
172172

173173
pathsegs = path.iter_segments(simplify=False, curves=False)
174174
for i, ((x, y), code) in enumerate(pathsegs):
@@ -181,7 +181,6 @@ def paths_to_3d_segments(paths, zs=0, zdir='z'):
181181
"""Convert paths from a collection object to 3D segments."""
182182

183183
zs = np.broadcast_to(zs, len(paths))
184-
185184
segs = [path_to_3d_segment(path, pathz, zdir)
186185
for path, pathz in zip(paths, zs)]
187186
return np.asarray(segs)
@@ -194,7 +193,7 @@ def path_to_3d_segment_with_codes(path, zs=0, zdir='z'):
194193
seg3d = np.ones((3, len(path)))
195194

196195
# Works both if zs is an array and a scalar
197-
seg3d[2] *= zs
196+
seg3d[2, :] *= zs
198197

199198
pathsegs = path.iter_segments(simplify=False, curves=False)
200199
codes = np.empty(len(path))
@@ -472,20 +471,21 @@ def set_3d_properties(self, zs, zdir):
472471
def do_3d_projection(self, renderer):
473472
xs, ys, zs = self._offsets3d
474473
vxyzis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)
474+
vzs = vxyzis[2]
475475

476-
fcs = (zalpha(self._facecolor3d, vxyzis[2]) if self._depthshade else
476+
fcs = (zalpha(self._facecolor3d, vzs) if self._depthshade else
477477
self._facecolor3d)
478478
fcs = mcolors.to_rgba_array(fcs, self._alpha)
479479
self.set_facecolors(fcs)
480480

481-
ecs = (zalpha(self._edgecolor3d, vxyzis[2]) if self._depthshade else
481+
ecs = (zalpha(self._edgecolor3d, vzs) if self._depthshade else
482482
self._edgecolor3d)
483483
ecs = mcolors.to_rgba_array(ecs, self._alpha)
484484
self.set_edgecolors(ecs)
485485
PathCollection.set_offsets(self, vxyzis[0:2].T)
486486

487-
if len(vxyzis) > 0:
488-
return min(vxyzis[2])
487+
if vzs.size > 0:
488+
return min(vzs)
489489
else:
490490
return np.nan
491491

@@ -580,9 +580,9 @@ def get_vector(self, segments3d):
580580
# Store the points in a single array for easier projection
581581
n_segments = np.sum(self._seg_sizes)
582582
# Put all segments in a big array
583-
self._vec = np.vstack(segments3d)
583+
_vec = np.vstack(segments3d)
584584
# Add a fourth dimension for quaternions
585-
self._vec = np.hstack([self._vec, np.ones((n_segments, 1))]).T
585+
self._vec = np.hstack([_vec, np.ones((n_segments, 1))]).T
586586

587587
def set_verts(self, verts, closed=True):
588588
"""Set 3D vertices."""

0 commit comments

Comments
 (0)