diff --git a/lib/mpl_toolkits/mplot3d/art3d.py b/lib/mpl_toolkits/mplot3d/art3d.py index 54d585bb645b..8c885a32ed06 100644 --- a/lib/mpl_toolkits/mplot3d/art3d.py +++ b/lib/mpl_toolkits/mplot3d/art3d.py @@ -589,7 +589,8 @@ def set_verts(self, verts, closed=True): '''Set 3D vertices.''' self.get_vector(verts) # 2D verts will be updated at draw time - PolyCollection.set_verts(self, [], closed) + PolyCollection.set_verts(self, [], False) + self._closed = closed def set_verts_and_codes(self, verts, codes): '''Sets 3D vertices with path codes''' @@ -654,7 +655,7 @@ def do_3d_projection(self, renderer): codes = [self._codes3d[idx] for z, s, fc, ec, idx in z_segments_2d] PolyCollection.set_verts_and_codes(self, segments_2d, codes) else: - PolyCollection.set_verts(self, segments_2d) + PolyCollection.set_verts(self, segments_2d, self._closed) self._facecolors2d = [fc for z, s, fc, ec, idx in z_segments_2d] if len(self._edgecolors3d) == len(cface): diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.pdf b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.pdf new file mode 100644 index 000000000000..004e6ca29ee6 Binary files /dev/null and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.pdf differ diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.png b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.png new file mode 100644 index 000000000000..2ae2eac27151 Binary files /dev/null and b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.png differ diff --git a/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.svg b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.svg new file mode 100644 index 000000000000..4221463648ee --- /dev/null +++ b/lib/mpl_toolkits/tests/baseline_images/test_mplot3d/poly3dcollection_closed.svg @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/mpl_toolkits/tests/test_mplot3d.py b/lib/mpl_toolkits/tests/test_mplot3d.py index 4656471ba037..6c9bd1f7586d 100644 --- a/lib/mpl_toolkits/tests/test_mplot3d.py +++ b/lib/mpl_toolkits/tests/test_mplot3d.py @@ -1,6 +1,6 @@ import pytest -from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d +from mpl_toolkits.mplot3d import Axes3D, axes3d, proj3d, art3d from matplotlib import cm from matplotlib.testing.decorators import image_comparison from matplotlib.collections import LineCollection @@ -312,6 +312,22 @@ def test_quiver3d_pivot_tail(): ax.quiver(x, y, z, u, v, w, length=0.1, pivot='tail', normalize=True) +@image_comparison(baseline_images=['poly3dcollection_closed'], + remove_text=True) +def test_poly3dcollection_closed(): + fig = plt.figure() + ax = fig.gca(projection='3d') + + poly1 = np.array([[0, 0, 1], [0, 1, 1], [0, 0, 0]], np.float) + poly2 = np.array([[0, 1, 1], [1, 1, 1], [1, 1, 0]], np.float) + c1 = art3d.Poly3DCollection([poly1], linewidths=3, edgecolor='k', + facecolor=(0.5, 0.5, 1, 0.5), closed=True) + c2 = art3d.Poly3DCollection([poly2], linewidths=3, edgecolor='k', + facecolor=(1, 0.5, 0.5, 0.5), closed=False) + ax.add_collection3d(c1) + ax.add_collection3d(c2) + + @image_comparison(baseline_images=['axes3d_labelpad'], extensions=['png']) def test_axes3d_labelpad(): from matplotlib import rcParams