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 1868c05

Browse filesBrowse files
committed
Fix issue with get_edgecolor and get_facecolor
1 parent 29a8663 commit 1868c05
Copy full SHA for 1868c05

File tree

Expand file treeCollapse file tree

2 files changed

+32
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+32
-0
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,19 @@ def set_alpha(self, alpha):
867867
self.stale = True
868868

869869
def get_facecolor(self):
870+
# docstring inherited
871+
# self._facecolors2d is not initialized until do_3d_projection
872+
if not hasattr(self, '_facecolors2d'):
873+
self.axes.M = self.axes.get_proj()
874+
self.do_3d_projection()
870875
return self._facecolors2d
871876

872877
def get_edgecolor(self):
878+
# docstring inherited
879+
# self._edgecolors2d is not initialized until do_3d_projection
880+
if not hasattr(self, '_edgecolors2d'):
881+
self.axes.M = self.axes.get_proj()
882+
self.do_3d_projection()
873883
return self._edgecolors2d
874884

875885

‎lib/mpl_toolkits/tests/test_mplot3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/tests/test_mplot3d.py
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,28 @@ def test_scatter_spiral():
18121812
fig.canvas.draw()
18131813

18141814

1815+
def test_Poly3DCollection_get_facecolor():
1816+
# Smoke test to see that get_facecolor does not raise
1817+
# See GH#4067
1818+
y, x = np.ogrid[1:10:100j, 1:10:100j]
1819+
z2 = np.cos(x) ** 3 - np.sin(y) ** 2
1820+
fig = plt.figure()
1821+
ax = fig.add_subplot(111, projection='3d')
1822+
r = ax.plot_surface(x, y, z2, cmap='hot')
1823+
r.get_facecolor()
1824+
1825+
1826+
def test_Poly3DCollection_get_edgecolor():
1827+
# Smoke test to see that get_edgecolor does not raise
1828+
# See GH#4067
1829+
y, x = np.ogrid[1:10:100j, 1:10:100j]
1830+
z2 = np.cos(x) ** 3 - np.sin(y) ** 2
1831+
fig = plt.figure()
1832+
ax = fig.add_subplot(111, projection='3d')
1833+
r = ax.plot_surface(x, y, z2, cmap='hot')
1834+
r.get_edgecolor()
1835+
1836+
18151837
@pytest.mark.parametrize(
18161838
"vertical_axis, proj_expected, axis_lines_expected, tickdirs_expected",
18171839
[

0 commit comments

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