Skip to content

do not ignore "closed" parameter in Poly3DCollection #8014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 6, 2017
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
5 changes: 3 additions & 2 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'''
Expand Down Expand Up @@ -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):
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion lib/mpl_toolkits/tests/test_mplot3d.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down