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

Skip to content

Commit 04952fe

Browse files
authored
Merge pull request #23563 from oscargus/line3ddraw
Fix issue with drawing 3D lines where points are from nparray
2 parents 7c5c23b + 0000367 commit 04952fe

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def __init__(self, xs, ys, zs, *args, **kwargs):
171171
def set_3d_properties(self, zs=0, zdir='z'):
172172
xs = self.get_xdata()
173173
ys = self.get_ydata()
174+
zs = cbook._to_unmasked_float_array(zs).ravel()
174175
zs = np.broadcast_to(zs, len(xs))
175176
self._verts3d = juggle_axes(xs, ys, zs, zdir)
176177
self.stale = True

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,13 @@ def test_text_3d(fig_test, fig_ref):
17861786
assert t3d.get_position_3d() == (0.5, 0.5, 1)
17871787

17881788

1789+
def test_draw_single_lines_from_Nx1():
1790+
# Smoke test for GH#23459
1791+
fig = plt.figure()
1792+
ax = fig.add_subplot(projection='3d')
1793+
ax.plot([[0], [1]], [[0], [1]], [[0], [1]])
1794+
1795+
17891796
@check_figures_equal(extensions=["png"])
17901797
def test_pathpatch_3d(fig_test, fig_ref):
17911798
ax = fig_ref.add_subplot(projection="3d")

0 commit comments

Comments
 (0)