@@ -931,7 +931,9 @@ def test_axes3d_labelpad():
931931 ax .set_xlabel ('X LABEL' , labelpad = 10 )
932932 assert ax .xaxis .labelpad == 10
933933 ax .set_ylabel ('Y LABEL' )
934- ax .set_zlabel ('Z LABEL' )
934+ ax .set_zlabel ('Z LABEL' , labelpad = 20 )
935+ assert ax .zaxis .labelpad == 20
936+ assert ax .get_zlabel () == 'Z LABEL'
935937 # or manually
936938 ax .yaxis .labelpad = 20
937939 ax .zaxis .labelpad = - 40
@@ -1124,6 +1126,7 @@ def test_lines_dists_nowarning():
11241126
11251127def test_autoscale ():
11261128 fig , ax = plt .subplots (subplot_kw = {"projection" : "3d" })
1129+ assert ax .get_zscale () == 'linear'
11271130 ax .margins (x = 0 , y = .1 , z = .2 )
11281131 ax .plot ([0 , 1 ], [0 , 1 ], [0 , 1 ])
11291132 assert ax .get_w_lims () == (0 , 1 , - .1 , 1.1 , - .2 , 1.2 )
@@ -1568,6 +1571,9 @@ def test_equal_box_aspect():
15681571 ax .axis ('off' )
15691572 ax .set_box_aspect ((1 , 1 , 1 ))
15701573
1574+ with pytest .raises (ValueError , match = "Argument zoom =" ):
1575+ ax .set_box_aspect ((1 , 1 , 1 ), zoom = - 1 )
1576+
15711577
15721578def test_colorbar_pos ():
15731579 num_plots = 2
@@ -1585,6 +1591,55 @@ def test_colorbar_pos():
15851591 assert cbar .ax .get_position ().extents [1 ] < 0.2
15861592
15871593
1594+ def test_inverted_zaxis ():
1595+ fig = plt .figure ()
1596+ ax = fig .add_subplot (projection = '3d' )
1597+ assert not ax .zaxis_inverted ()
1598+ assert ax .get_zlim () == (0 , 1 )
1599+ assert ax .get_zbound () == (0 , 1 )
1600+
1601+ # Change bound
1602+ ax .set_zbound ((0 , 2 ))
1603+ assert not ax .zaxis_inverted ()
1604+ assert ax .get_zlim () == (0 , 2 )
1605+ assert ax .get_zbound () == (0 , 2 )
1606+
1607+ # Change invert
1608+ ax .invert_zaxis ()
1609+ assert ax .zaxis_inverted ()
1610+ assert ax .get_zlim () == (2 , 0 )
1611+ assert ax .get_zbound () == (0 , 2 )
1612+
1613+ # Set upper bound
1614+ ax .set_zbound (upper = 1 )
1615+ assert ax .zaxis_inverted ()
1616+ assert ax .get_zlim () == (1 , 0 )
1617+ assert ax .get_zbound () == (0 , 1 )
1618+
1619+ # Set lower bound
1620+ ax .set_zbound (lower = 2 )
1621+ assert ax .zaxis_inverted ()
1622+ assert ax .get_zlim () == (2 , 1 )
1623+ assert ax .get_zbound () == (1 , 2 )
1624+
1625+
1626+ def test_set_zlim ():
1627+ fig = plt .figure ()
1628+ ax = fig .add_subplot (projection = '3d' )
1629+ assert ax .get_zlim () == (0 , 1 )
1630+ ax .set_zlim (zmax = 2 )
1631+ assert ax .get_zlim () == (0 , 2 )
1632+ ax .set_zlim (zmin = 1 )
1633+ assert ax .get_zlim () == (1 , 2 )
1634+
1635+ with pytest .raises (
1636+ TypeError , match = "Cannot pass both 'bottom' and 'zmin'" ):
1637+ ax .set_zlim (bottom = 0 , zmin = 1 )
1638+ with pytest .raises (
1639+ TypeError , match = "Cannot pass both 'top' and 'zmax'" ):
1640+ ax .set_zlim (top = 0 , zmax = 1 )
1641+
1642+
15881643def test_shared_axes_retick ():
15891644 fig = plt .figure ()
15901645 ax1 = fig .add_subplot (211 , projection = "3d" )
0 commit comments