@@ -416,6 +416,31 @@ def test_text3d():
416416 ax .set_zlabel ('Z axis' )
417417
418418
419+ @check_figures_equal (extensions = ['png' ])
420+ def test_text3d_modification (fig_ref , fig_test ):
421+ # Modifying the Text position after the fact should work the same as
422+ # setting it directly.
423+ zdirs = (None , 'x' , 'y' , 'z' , (1 , 1 , 0 ), (1 , 1 , 1 ))
424+ xs = (2 , 6 , 4 , 9 , 7 , 2 )
425+ ys = (6 , 4 , 8 , 7 , 2 , 2 )
426+ zs = (4 , 2 , 5 , 6 , 1 , 7 )
427+
428+ ax_test = fig_test .add_subplot (projection = '3d' )
429+ ax_test .set_xlim3d (0 , 10 )
430+ ax_test .set_ylim3d (0 , 10 )
431+ ax_test .set_zlim3d (0 , 10 )
432+ for zdir , x , y , z in zip (zdirs , xs , ys , zs ):
433+ t = ax_test .text (0 , 0 , 0 , f'({ x } , { y } , { z } ), dir={ zdir } ' )
434+ t .set_position_3d ((x , y , z ), zdir = zdir )
435+
436+ ax_ref = fig_ref .add_subplot (projection = '3d' )
437+ ax_ref .set_xlim3d (0 , 10 )
438+ ax_ref .set_ylim3d (0 , 10 )
439+ ax_ref .set_zlim3d (0 , 10 )
440+ for zdir , x , y , z in zip (zdirs , xs , ys , zs ):
441+ ax_ref .text (x , y , z , f'({ x } , { y } , { z } ), dir={ zdir } ' , zdir = zdir )
442+
443+
419444@mpl3d_image_comparison (['trisurf3d.png' ], tol = 0.03 )
420445def test_trisurf3d ():
421446 n_angles = 36
0 commit comments