FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix array-like linewidth for 3d scatter by krassowski · Pull Request #23434 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .png  (1) .py  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions lib/mpl_toolkits/mplot3d/art3d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def set_3d_properties(self, zs, zdir):
#
# Grab the current sizes and linewidths to preserve them.
self._sizes3d = self._sizes
self._linewidths3d = self._linewidths
self._linewidths3d = np.array(self._linewidths)
xs, ys, zs = self._offsets3d

# Sort the points based on z coordinates
Expand All @@ -563,7 +563,7 @@ def set_sizes(self, sizes, dpi=72.0):
def set_linewidth(self, lw):
super().set_linewidth(lw)
if not self._in_draw:
self._linewidth3d = lw
self._linewidths3d = np.array(self._linewidths)

def get_depthshade(self):
return self._depthshade
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
24 changes: 24 additions & 0 deletions lib/mpl_toolkits/tests/test_mplot3d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,30 @@ def test_scatter3d_color():
color='b', marker='s')


@mpl3d_image_comparison(['scatter3d_linewidth.png'])
def test_scatter3d_linewidth():
fig = plt.figure()
ax = fig.add_subplot(projection='3d')

# Check that array-like linewidth can be set
ax.scatter(np.arange(10), np.arange(10), np.arange(10),
marker='o', linewidth=np.arange(10))


@check_figures_equal(extensions=['png'])
def test_scatter3d_linewidth_modification(fig_ref, fig_test):
# Changing Path3DCollection linewidths with array-like post-creation
# should work correctly.
ax_test = fig_test.add_subplot(projection='3d')
c = ax_test.scatter(np.arange(10), np.arange(10), np.arange(10),
marker='o')
c.set_linewidths(np.arange(10))

ax_ref = fig_ref.add_subplot(projection='3d')
ax_ref.scatter(np.arange(10), np.arange(10), np.arange(10), marker='o',
linewidths=np.arange(10))


@check_figures_equal(extensions=['png'])
def test_scatter3d_modification(fig_ref, fig_test):
# Changing Path3DCollection properties post-creation should work correctly.
Expand Down

Back | FazBrowse Home | New Git URL