@@ -475,6 +475,44 @@ def test_EllipseCollection():
475
475
ax .autoscale_view ()
476
476
477
477
478
+ @image_comparison (baseline_images = ['polycollection_close' ],
479
+ extensions = ['png' ], remove_text = True )
480
+ def test_polycollection_close ():
481
+ from mpl_toolkits .mplot3d import Axes3D
482
+
483
+ vertsQuad = [
484
+ [[0. , 0. ], [0. , 1. ], [1. , 1. ], [1. , 0. ]],
485
+ [[0. , 1. ], [2. , 3. ], [2. , 2. ], [1. , 1. ]],
486
+ [[2. , 2. ], [2. , 3. ], [4. , 1. ], [3. , 1. ]],
487
+ [
8000
[3. , 0. ], [3. , 1. ], [4. , 1. ], [4. , 0. ]]]
488
+
489
+ fig = plt .figure ()
490
+ ax = Axes3D (fig )
491
+
492
+ colors = ['r' , 'g' , 'b' , 'y' , 'k' ]
493
+ zpos = list (range (5 ))
494
+
495
+ poly = mcollections .PolyCollection (
496
+ vertsQuad * len (zpos ), linewidth = 0.25 )
497
+ poly .set_alpha (0.7 )
498
+
499
+ ## need to have a z-value for *each* polygon = element!
500
+ zs = []
501
+ cs = []
502
+ for z , c in zip (zpos , colors ):
503
+ zs .extend ([z ] * len (vertsQuad ))
504
+ cs .extend ([c ] * len (vertsQuad ))
505
+
506
+ poly .set_color (cs )
507
+
508
+ ax .add_collection3d (poly , zs = zs , zdir = 'y' )
509
+
510
+ ## axis limit settings:
511
+ ax .set_xlim3d (0 , 4 )
512
+ ax .set_zlim3d (0 , 3 )
513
+ ax .set_ylim3d (0 , 4 )
514
+
515
+
478
516
if __name__ == '__main__' :
479
517
import nose
480
518
nose .runmodule (argv = ['-s' , '--with-doctest' ], exit = False )
0 commit comments