@@ -931,7 +931,9 @@ def test_axes3d_labelpad():
931
931
ax .set_xlabel ('X LABEL' , labelpad = 10 )
932
932
assert ax .xaxis .labelpad == 10
933
933
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'
935
937
# or manually
936
938
ax .yaxis .labelpad = 20
937
939
ax .zaxis .labelpad = - 40
@@ -1124,6 +1126,7 @@ def test_lines_dists_nowarning():
1124
1126
1125
1127
def test_autoscale ():
1126
1128
fig , ax = plt .subplots (subplot_kw = {"projection" : "3d" })
1129
+ assert ax .get_zscale () == 'linear'
1127
1130
ax .margins (x = 0 , y = .1 , z = .2 )
1128
1131
ax .plot ([0 , 1 ], [0 , 1 ], [0 , 1 ])
1129
1132
assert ax .get_w_lims () == (0 , 1 , - .1 , 1.1 , - .2 , 1.2 )
@@ -1568,6 +1571,9 @@ def test_equal_box_aspect():
1568
1571
ax .axis ('off' )
1569
1572
ax .set_box_aspect ((1 , 1 , 1 ))
1570
1573
1574
+ with pytest .raises (ValueError , match = "Argument zoom =" ):
1575
+ ax .set_box_aspect ((1 , 1 , 1 ), zoom = - 1 )
1576
+
1571
1577
1572
1578
def test_colorbar_pos ():
1573
1579
num_plots = 2
@@ -1585,6 +1591,55 @@ def test_colorbar_pos():
1585
1591
assert cbar .ax .get_position ().extents [1 ] < 0.2
1586
1592
1587
1593
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
+
1588
1643
def test_shared_axes_retick ():
1589
1644
fig = plt .figure ()
1590
1645
ax1 = fig .add_subplot (211 , projection = "3d" )
0 commit comments