@@ -1196,6 +1196,7 @@ def test_lines_dists_nowarning():
1196
1196
def test_autoscale ():
1197
1197
fig , ax = plt .subplots (subplot_kw = {"projection" : "3d" })
1198
1198
assert ax .get_zscale () == 'linear'
1199
+ ax ._view_margin = 0
1199
1200
ax .margins (x = 0 , y = .1 , z = .2 )
1200
1201
ax .plot ([0 , 1 ], [0 , 1 ], [0 , 1 ])
1201
1202
assert ax .get_w_lims () == (0 , 1 , - .1 , 1.1 , - .2 , 1.2 )
@@ -1675,6 +1676,7 @@ def test_colorbar_pos():
1675
1676
def test_inverted_zaxis ():
1676
1677
fig = plt .figure ()
1677
1678
ax = fig .add_subplot (projection = '3d' )
1679
+ ax .set_zlim (0 , 1 )
1678
1680
assert not ax .zaxis_inverted ()
1679
1681
assert ax .get_zlim () == (0 , 1 )
1680
1682
assert ax .get_zbound () == (0 , 1 )
@@ -1707,17 +1709,17 @@ def test_inverted_zaxis():
1707
1709
def test_set_zlim ():
1708
1710
fig = plt .figure ()
1709
1711
ax = fig .add_subplot (projection = '3d' )
1710
- assert ax .get_zlim () == ( 0 , 1 )
1712
+ assert np . allclose ( ax .get_zlim (), ( - 1 / 48 , 49 / 48 ) )
1711
1713
ax .set_zlim (zmax = 2 )
1712
- assert ax .get_zlim () == ( 0 , 2 )
1714
+ assert np . allclose ( ax .get_zlim (), ( - 1 / 48 , 2 ) )
1713
1715
ax .set_zlim (zmin = 1 )
1714
1716
assert ax .get_zlim () == (1 , 2 )
1715
1717
1716
1718
with pytest .raises (
1717
- TypeError , match = "Cannot pass both 'bottom ' and 'zmin '" ):
1719
+ TypeError , match = "Cannot pass both 'lower ' and 'min '" ):
1718
1720
ax .set_zlim (bottom = 0 , zmin = 1 )
1719
1721
with pytest .raises (
1720
- TypeError , match = "Cannot pass both 'top ' and 'zmax '" ):
1722
+ TypeError , match = "Cannot pass both 'upper ' and 'max '" ):
1721
1723
ax .set_zlim (top = 0 , zmax = 1 )
1722
1724
1723
1725
@@ -1777,13 +1779,13 @@ def convert_lim(dmin, dmax):
1777
1779
("zoom" , MouseButton .LEFT , 'x' , # zoom in
1778
1780
((- 0.01 , 0.10 ), (- 0.03 , 0.08 ), (- 0.06 , 0.06 ))),
1779
1781
("zoom" , MouseButton .LEFT , 'y' , # zoom in
1780
- ((- 0.07 , 0.04 ), (- 0.03 , 0.08 ), (0.00 , 0.11 ))),
1782
+ ((- 0.07 , 0.05 ), (- 0.04 , 0.08 ), (0.00 , 0.12 ))),
1781
1783
("zoom" , MouseButton .RIGHT , None , # zoom out
1782
- ((- 0.09 , 0.15 ), (- 0.07 , 0.17 ), (- 0.06 , 0.18 ))),
1784
+ ((- 0.09 , 0.15 ), (- 0.08 , 0.17 ), (- 0.07 , 0.18 ))),
1783
1785
("pan" , MouseButton .LEFT , None ,
1784
- ((- 0.70 , - 0.58 ), (- 1.03 , - 0.91 ), (- 1.27 , - 1.15 ))),
1786
+ ((- 0.70 , - 0.58 ), (- 1.04 , - 0.91 ), (- 1.27 , - 1.15 ))),
1785
1787
("pan" , MouseButton .LEFT , 'x' ,
1786
- ((- 0.96 , - 0.84 ), (- 0.58 , - 0.46 ), (- 0.06 , 0.06 ))),
1788
+ ((- 0.97 , - 0.84 ), (- 0.58 , - 0.46 ), (- 0.06 , 0.06 ))),
1787
1789
("pan" , MouseButton .LEFT , 'y' ,
1788
1790
((0.20 , 0.32 ), (- 0.51 , - 0.39 ), (- 1.27 , - 1.15 )))])
1789
1791
def test_toolbar_zoom_pan (tool , button , key , expected ):
@@ -1968,15 +1970,15 @@ def test_format_coord():
1968
1970
x = np .arange (10 )
1969
1971
ax .plot (x , np .sin (x ))
1970
1972
fig .canvas .draw ()
1971
- assert ax .format_coord (0 , 0 ) == 'x=1.8066 , y=1.0367 , z=−0.0553 '
1973
+ assert ax .format_coord (0 , 0 ) == 'x=1.6944 , y=1.0799 , z=−0.0576 '
1972
1974
# Modify parameters
1973
1975
ax .view_init (roll = 30 , vertical_axis = "y" )
1974
1976
fig .canvas .draw ()
1975
- assert ax .format_coord (0 , 0 ) == 'x=9.1651 , y=−0.9215 , z=−0.0359 '
1977
+ assert ax .format_coord (0 , 0 ) == 'x=9.3595 , y=−0.9599 , z=−0.0374 '
1976
1978
# Reset parameters
1977
1979
ax .view_init ()
1978
1980
fig .canvas .draw ()
1979
- assert ax .format_coord (0 , 0 ) == 'x=1.8066 , y=1.0367 , z=−0.0553 '
1981
+ assert ax .format_coord (0 , 0 ) == 'x=1.6944 , y=1.0799 , z=−0.0576 '
1980
1982
1981
1983
1982
1984
def test_get_axis_position ():
0 commit comments