Skip to content

Commit be532e3

Browse files
committed
Return the list of added Poly3DCollections
1 parent 61550af commit be532e3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,6 +2666,11 @@ def voxels(self, filled, color=None):
26662666
Either a single value or an array the same shape as filled,
26672667
indicating what color to draw the faces of the voxels. If None,
26682668
plot all voxels in the same color, the next in the color sequence
2669+
2670+
Returns
2671+
-------
2672+
list of `Poly3DCollection`
2673+
The square faces which were plotted, in an arbitrary order
26692674
"""
26702675
# check dimensions, and deal with a single color
26712676
if filled.ndim != 3:
@@ -2689,6 +2694,7 @@ def voxels(self, filled, color=None):
26892694
[0, filled.shape[2]]
26902695
)
26912696

2697+
polygons = []
26922698

26932699
# points lying on corners of a square
26942700
square = np.array([
@@ -2703,6 +2709,7 @@ def boundary_found(corners, color):
27032709
poly = art3d.Poly3DCollection([corners])
27042710
poly.set_facecolor(color)
27052711
self.add_collection3d(poly)
2712+
polygons.append(poly)
27062713

27072714
def permutation_matrices(n):
27082715
""" Generator of cyclic permutation matices """
@@ -2746,6 +2753,8 @@ def permutation_matrices(n):
27462753
if filled[ik]:
27472754
boundary_found(pk2 + square.dot(permute.T), color[ik])
27482755

2756+
return polygons
2757+
27492758

27502759
def get_test_data(delta=0.05):
27512760
'''

0 commit comments

Comments
 (0)