Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbc4e35

Browse filesBrowse files
authored
Merge pull request #20555 from wangzexi/master
Fix the way to get xs length in set_3d_properties()
2 parents d686d73 + adb19fa commit cbc4e35
Copy full SHA for cbc4e35

File tree

Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-1
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __init__(self, xs, ys, zs, *args, **kwargs):
172172
def set_3d_properties(self, zs=0, zdir='z'):
173173
xs = self.get_xdata()
174174
ys = self.get_ydata()
175-
zs = np.broadcast_to(zs, xs.shape)
175+
zs = np.broadcast_to(zs, len(xs))
176176
self._verts3d = juggle_axes(xs, ys, zs, zdir)
177177
self.stale = True
178178

‎lib/mpl_toolkits/tests/test_mplot3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,12 @@ def test_line3d_set_get_data_3d():
11191119
np.testing.assert_array_equal((x, y, z), line.get_data_3d())
11201120
line.set_data_3d(x2, y2, z2)
11211121
np.testing.assert_array_equal((x2, y2, z2), line.get_data_3d())
1122+
line.set_xdata(x)
1123+
line.set_ydata(y)
1124+
line.set_3d_properties(zs=z, zdir='z')
1125+
np.testing.assert_array_equal((x, y, z), line.get_data_3d())
1126+
line.set_3d_properties(zs=0, zdir='z')
1127+
np.testing.assert_array_equal((x, y, np.zeros_like(z)), line.get_data_3d())
11221128

11231129

11241130
@check_figures_equal(extensions=["png"])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.