@@ -2666,6 +2666,11 @@ def voxels(self, filled, color=None):
2666
2666
Either a single value or an array the same shape as filled,
2667
2667
indicating what color to draw the faces of the voxels. If None,
2668
2668
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
2669
2674
"""
2670
2675
# check dimensions, and deal with a single color
2671
2676
if filled .ndim != 3 :
@@ -2689,6 +2694,7 @@ def voxels(self, filled, color=None):
2689
2694
[0 , filled .shape [2 ]]
2690
2695
)
2691
2696
2697
+ polygons = []
2692
2698
2693
2699
# points lying on corners of a square
2694
2700
square = np .array ([
@@ -2703,6 +2709,7 @@ def boundary_found(corners, color):
2703
2709
poly = art3d .Poly3DCollection ([corners ])
2704
2710
poly .set_facecolor (color )
2705
2711
self .add_collection3d (poly )
2712
+ polygons .append (poly )
2706
2713
2707
2714
def permutation_matrices (n ):
2708
2715
""" Generator of cyclic permutation matices """
@@ -2746,6 +2753,8 @@ def permutation_matrices(n):
2746
2753
if filled [ik ]:
2747
2754
boundary_found (pk2 + square .dot (permute .T ), color [ik ])
2748
2755
2756
+ return polygons
2757
+
2749
2758
2750
2759
def get_test_data (delta = 0.05 ):
2751
2760
'''
0 commit comments