@@ -131,6 +131,17 @@ def test_contour3d():
131131 ax .set_zlim (- 100 , 100 )
132132
133133
134+ @mpl3d_image_comparison (['contour3d_extend3d.png' ])
135+ def test_contour3d_extend3d ():
136+ fig = plt .figure ()
137+ ax = fig .add_subplot (projection = '3d' )
138+ X , Y , Z = axes3d .get_test_data (0.05 )
139+ ax .contour (X , Y , Z , zdir = 'z' , offset = - 100 , cmap = cm .coolwarm , extend3d = True )
140+ ax .set_xlim (- 30 , 30 )
141+ ax .set_ylim (- 20 , 40 )
142+ ax .set_zlim (- 80 , 80 )
143+
144+
134145@mpl3d_image_comparison (['contourf3d.png' ])
135146def test_contourf3d ():
136147 fig = plt .figure ()
@@ -1029,6 +1040,9 @@ def test_autoscale():
10291040 ax .set_autoscalez_on (True )
10301041 ax .plot ([0 , 2 ], [0 , 2 ], [0 , 2 ])
10311042 assert ax .get_w_lims () == (0 , 1 , - .1 , 1.1 , - .4 , 2.4 )
1043+ ax .autoscale (axis = 'x' )
1044+ ax .plot ([0 , 2 ], [0 , 2 ], [0 , 2 ])
1045+ assert ax .get_w_lims () == (0 , 2 , - .1 , 1.1 , - .4 , 2.4 )
10321046
10331047
10341048@pytest .mark .parametrize ('axis' , ('x' , 'y' , 'z' ))
@@ -1643,6 +1657,52 @@ def test_computed_zorder():
16431657 ax .axis ('off' )
16441658
16451659
1660+ def test_format_coord ():
1661+ fig = plt .figure ()
1662+ ax = fig .add_subplot (projection = '3d' )
1663+ x = np .arange (10 )
1664+ ax .plot (x , np .sin (x ))
1665+ fig .canvas .draw ()
1666+ assert ax .format_coord (0 , 0 ) == 'x=1.8066, y=1.0367, z=−0.0553'
1667+ # Modify parameters
1668+ ax .view_init (roll = 30 , vertical_axis = "y" )
1669+ fig .canvas .draw ()
1670+ assert ax .format_coord (0 , 0 ) == 'x=9.1651, y=−0.9215, z=−0.0359'
1671+ # Reset parameters
1672+ ax .view_init ()
1673+ fig .canvas .draw ()
1674+ assert ax .format_coord (0 , 0 ) == 'x=1.8066, y=1.0367, z=−0.0553'
1675+
1676+
1677+ def test_get_axis_position ():
1678+ fig = plt .figure ()
1679+ ax = fig .add_subplot (projection = '3d' )
1680+ x = np.arange (10 )
1681+ ax .plot (x , np .sin (x ))
1682+ fig .canvas .draw ()
1683+ assert ax .get_axis_position () == (False , True , False )
1684+
1685+
1686+ def test_margins ():
1687+ fig = plt .figure ()
1688+ ax = fig .add_subplot (projection = '3d' )
1689+ ax .margins (0.2 )
1690+ assert ax .margins () == (0.2 , 0.2 , 0.2 )
1691+ ax .margins (0.1 , 0.2 , 0.3 )
1692+ assert ax .margins () == (0.1 , 0.2 , 0.3 )
1693+ ax .margins (x = 0 )
1694+ assert ax .margins () == (0 , 0.2 , 0.3 )
1695+
1696+
1697+ def test_margins_errors ():
1698+ fig = plt .figure ()
1699+ ax = fig .add_subplot (projection = '3d' )
1700+ with pytest .raises (TypeError , match = "Cannot pass" ):
1701+ ax .margins (0.2 , x = 0.4 )
1702+ with pytest .raises (TypeError , match = "Must pass" ):
1703+ ax .margins (0.2 , 0.4 )
1704+
1705+
16461706@image_comparison (baseline_images = ['scatter_spiral.png' ],
16471707 remove_text = True ,
16481708 style = 'default' )
0 commit comments