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 3218077

Browse filesBrowse files
authored
Merge pull request #13587 from meeseeksmachine/auto-backport-of-pr-13573-on-v3.1.x
Backport PR #13573 on branch v3.1.x (Fix mplot3d transparency)
2 parents 72a71c9 + d1b9316 commit 3218077
Copy full SHA for 3218077

File tree

Expand file treeCollapse file tree

3 files changed

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

3 files changed

+19
-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
@@ -758,7 +758,7 @@ def set_alpha(self, alpha):
758758
raise TypeError('alpha must be a float or None')
759759
artist.Artist.set_alpha(self, alpha)
760760
try:
761-
self._facecolors = mcolors.to_rgba_array(
761+
self._facecolors3d = mcolors.to_rgba_array(
762762
self._facecolors3d, self._alpha)
763763
except (AttributeError, TypeError, IndexError):
764764
pass
Loading

‎lib/mpl_toolkits/tests/test_mplot3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,24 @@ def test_poly_collection_2d_to_3d_empty():
454454
assert poly.get_paths() == []
455455

456456

457+
@image_comparison(baseline_images=['poly3dcollection_alpha'],
458+
remove_text=True, extensions=['png'])
459+
def test_poly3dcollection_alpha():
460+
fig = plt.figure()
461+
ax = fig.gca(projection='3d')
462+
463+
poly1 = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], float)
464+
poly2 = np.array([[0, 1, 1], [1, 1, 1], [1, 1, 0]], float)
465+
c1 = art3d.Poly3DCollection([poly1], linewidths=3, edgecolor='k',
466+
facecolor=(0.5, 0.5, 1), closed=True)
467+
c1.set_alpha(0.5)
468+
c2 = art3d.Poly3DCollection([poly2], linewidths=3, edgecolor='k',
469+
facecolor=(1, 0.5, 0.5), closed=False)
470+
c2.set_alpha(0.5)
471+
ax.add_collection3d(c1)
472+
ax.add_collection3d(c2)
473+
474+
457475
@image_comparison(baseline_images=['axes3d_labelpad'], extensions=['png'])
458476
def test_axes3d_labelpad():
459477
from matplotlib import rcParams

0 commit comments

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