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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,19 @@ def set_alpha(self, alpha):
self.stale = True

def get_facecolor(self):
# docstring inherited
# self._facecolors2d is not initialized until do_3d_projection
if not hasattr(self, '_facecolors2d'):
self.axes.M = self.axes.get_proj()
self.do_3d_projection()
return self._facecolors2d

def get_edgecolor(self):
# docstring inherited
# self._edgecolors2d is not initialized until do_3d_projection
if not hasattr(self, '_edgecolors2d'):
self.axes.M = self.axes.get_proj()
self.do_3d_projection()
return self._edgecolors2d


Expand Down
22 changes: 22 additions & 0 deletions lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,28 @@ def test_scatter_spiral():
fig.canvas.draw()


def test_Poly3DCollection_get_facecolor():
# Smoke test to see that get_facecolor does not raise
# See GH#4067
y, x = np.ogrid[1:10:100j, 1:10:100j]
z2 = np.cos(x) ** 3 - np.sin(y) ** 2
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
r = ax.plot_surface(x, y, z2, cmap='hot')
r.get_facecolor()


def test_Poly3DCollection_get_edgecolor():
# Smoke test to see that get_edgecolor does not raise
# See GH#4067
y, x = np.ogrid[1:10:100j, 1:10:100j]
z2 = np.cos(x) ** 3 - np.sin(y) ** 2
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
r = ax.plot_surface(x, y, z2, cmap='hot')
r.get_edgecolor()


@pytest.mark.parametrize(
"vertical_axis, proj_expected, axis_lines_expected, tickdirs_expected",
[
Expand Down