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

Skip to content

Commit 657942a

Browse files
Fix test regressions
1 parent 0fb87fc commit 657942a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ def _apply_scale_transforms(xs, ys, zs, axes):
9292
xs_scaled, ys_scaled, zs_scaled : np.ndarray
9393
The coordinates in scaled space.
9494
"""
95-
xs = np.asarray(xs)
96-
ys = np.asarray(ys)
97-
zs = np.asarray(zs)
95+
# Use asanyarray to preserve masked arrays
96+
xs = np.asanyarray(xs)
97+
ys = np.asanyarray(ys)
98+
zs = np.asanyarray(zs)
9899

99100
# Get the scale transforms for each axis
100101
x_trans = axes.xaxis.get_transform()
@@ -568,6 +569,11 @@ def do_3d_projection(self):
568569
"""
569570
segments = np.asanyarray(self._segments3d)
570571

572+
# Handle empty segments
573+
if segments.size == 0:
574+
LineCollection.set_segments(self, [])
575+
return np.nan
576+
571577
mask = False
572578
if np.ma.isMA(segments):
573579
mask = segments.mask

0 commit comments

Comments
 (0)