Skip to content

Commit 1c715f9

Browse files
Bugfix
Tests Tests
1 parent 5a56329 commit 1c715f9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def do_3d_projection(self):
455455
all_points = np.ma.vstack(segments)
456456
masked_points = np.ma.column_stack([*_viewlim_mask(*all_points.T,
457457
self.axes)])
458-
segment_lengths = [segment.shape[0] for segment in segments]
458+
segment_lengths = [np.asanyarray(segment).shape[0] for segment in segments]
459459
segments = np.split(masked_points, np.cumsum(segment_lengths[:-1]))
460460
xyslist = [proj3d._proj_trans_points(points, self.axes.M)
461461
for points in segments]

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1389,14 +1389,15 @@ def test_axlim_clip(fig_test, fig_ref):
13891389
Z = X + Y
13901390
ax.plot_surface(X, Y, Z, facecolor='C1', edgecolors=None,
13911391
rcount=50, ccount=50, axlim_clip=True)
1392+
ax.plot_wireframe(X, Y, Z + 0.5, color='C2', rcount=50, ccount=50, axlim_clip=True)
13921393
# This ax.plot is to cover the extra surface edge which is not clipped out
13931394
ax.plot([0.5, 0.5], [0, 1], [0.5, 1.5],
13941395
color='k', linewidth=3, zorder=5, axlim_clip=True)
13951396
ax.scatter(X.ravel(), Y.ravel(), Z.ravel() + 1, axlim_clip=True)
13961397
ax.quiver(X.ravel(), Y.ravel(), Z.ravel() + 2,
13971398
0*X.ravel(), 0*Y.ravel(), 0*Z.ravel() + 1,
13981399
arrow_length_ratio=0, axlim_clip=True)
1399-
ax.plot(X[0], Y[0], Z[0] + 3, color='C2', axlim_clip=True)
1400+
ax.plot(X[0], Y[0], Z[0] + 3, color='C3', axlim_clip=True)
14001401
ax.text(1.1, 0.5, 4, 'test', axlim_clip=True) # won't be visible
14011402
ax.set(xlim=(0, 0.5), ylim=(0, 1), zlim=(0, 5))
14021403

@@ -1408,13 +1409,15 @@ def test_axlim_clip(fig_test, fig_ref):
14081409
Z = Z[idx].reshape(11, 6)
14091410
ax.plot_surface(X, Y, Z, facecolor='C1', edgecolors=None,
14101411
rcount=50, ccount=50, axlim_clip=False)
1412+
ax.plot_wireframe(X, Y, Z + 0.5, color='C2',
1413+
rcount=50, ccount=50, axlim_clip=False)
14111414
ax.plot([0.5, 0.5], [0, 1], [0.5, 1.5],
14121415
color='k', linewidth=3, zorder=5, axlim_clip=False)
14131416
ax.scatter(X.ravel(), Y.ravel(), Z.ravel() + 1, axlim_clip=False)
14141417
ax.quiver(X.ravel(), Y.ravel(), Z.ravel() + 2,
14151418
0*X.ravel(), 0*Y.ravel(), 0*Z.ravel() + 1,
14161419
arrow_length_ratio=0, axlim_clip=False)
1417-
ax.plot(X[0], Y[0], Z[0] + 3, color='C2', axlim_clip=False)
1420+
ax.plot(X[0], Y[0], Z[0] + 3, color='C3', axlim_clip=False)
14181421
ax.set(xlim=(0, 0.5), ylim=(0, 1), zlim=(0, 5))
14191422

14201423

0 commit comments

Comments
 (0)