Skip to content

Commit e3caacd

Browse files
committed
Tune mplot3d patch collection modification test
Previously there was an untested path for the case when facecolors array had more then one color.
1 parent 357db6d commit e3caacd

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/mpl_toolkits/tests/test_mplot3d.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -601,22 +601,26 @@ def test_patch_modification():
601601
@check_figures_equal(extensions=['png'])
602602
def test_patch_collection_modification(fig_test, fig_ref):
603603
# Test that modifying Patch3DCollection properties after creation works.
604-
patch = Circle((0, 0), 0.05)
605-
c = art3d.Patch3DCollection([patch], linewidths=3)
604+
patch1 = Circle((0, 0), 0.05)
605+
patch2 = Circle((0.1, 0.1), 0.03)
606+
facecolors = np.array([[0., 0.5, 0., 1.], [0.5, 0., 0., 0.5]])
607+
c = art3d.Patch3DCollection([patch1, patch2], linewidths=3)
606608

607609
ax_test = fig_test.add_subplot(projection='3d')
608610
ax_test.add_collection3d(c)
609611
c.set_edgecolor('C2')
610-
c.set_facecolor('C3')
612+
c.set_facecolor(facecolors)
611613
c.set_alpha(0.7)
612614
assert c.get_depthshade()
613615
c.set_depthshade(False)
614616
assert not c.get_depthshade()
615617

616-
patch = Circle((0, 0), 0.05)
617-
c = art3d.Patch3DCollection([patch], linewidths=3,
618-
edgecolor='C2', facecolor='C3', alpha=0.7,
619-
depthshade=False)
618+
patch1 = Circle((0, 0), 0.05)
619+
patch2 = Circle((0.1, 0.1), 0.03)
620+
facecolors = np.array([[0., 0.5, 0., 1.], [0.5, 0., 0., 0.5]])
621+
c = art3d.Patch3DCollection([patch1, patch2], linewidths=3,
622+
edgecolor='C2', facecolor=facecolors,
623+
alpha=0.7, depthshade=False)
620624

621625
ax_ref = fig_ref.add_subplot(projection='3d')
622626
ax_ref.add_collection3d(c)

0 commit comments

Comments
 (0)