Skip to content

Commit 76d5dc7

Browse files
committed
Fix one test failure
1 parent ff18f5f commit 76d5dc7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def paths_to_3d_segments_with_codes(paths, zs=0, zdir='z'):
246246

247247
return np.asarray(segments), np.asarray(codes_list)
248248
else:
249-
return np.empty((3, 0), dtype='float64'), np.array([], dtype='uint8')
249+
return np.empty((0, 3), dtype=np.float64), np.array([], dtype=np.uint8)
250250

251251

252252
class Line3DCollection(LineCollection):
@@ -606,15 +606,17 @@ def set_zsort(self, zsort):
606606
def get_vector(self, segments3d):
607607
"""Optimize points for projection"""
608608

609-
self._seg_sizes = np.array([len(c) for c in segments3d])
609+
self._seg_sizes = np.array([len(c) for c in segments3d], dtype=np.int)
610610
self._vec = []
611611

612612
# Store the points in a single array for easier projection
613613
n_segments = np.sum(self._seg_sizes)
614614
self._vec = np.empty((4, n_segments))
615615
# Put all segments in a big array
616-
self._vec[:3, :] = np.vstack(segments3d).T
617-
self._vec[3, :] = 1
616+
# TODO: avoid copy in np.vstack when segments3d is a 3D numpy array
617+
if n_segments:
618+
self._vec[:3, :] = np.vstack(segments3d).T
619+
self._vec[3, :] = 1
618620

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

0 commit comments

Comments
 (0)