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

Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def draw(self, renderer):
if np.any(scale_mask):
mask = np.broadcast_to(
scale_mask,
(len(self._verts3d), *self._verts3d[0].shape)
(len(self._verts3d), *np.shape(self._verts3d[0]))
)
xs3d, ys3d, zs3d = np.ma.array(self._verts3d,
dtype=float, mask=mask).filled(np.nan)
Expand Down
12 changes: 12 additions & 0 deletions lib/mpl_toolkits/mplot3d/tests/test_art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
)


def test_line3d_set_data_3d_list_with_nan():
# Regression test for #32127: set_data_3d stores array-like as given, and
# draw must not require ndarray .shape when a coordinate is non-finite.
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
line, = ax.plot([0.0], [0.0], [0.0])
xs, ys, zs = [float("nan")], [float("nan")], [float("nan")]
line.set_data_3d(xs, ys, zs)
assert line.get_data_3d() == (xs, ys, zs)
fig.canvas.draw()


@pytest.mark.parametrize("zdir, expected", [
("x", (1, 0, 0)),
("y", (0, 1, 0)),
Expand Down
Loading