@@ -1196,6 +1196,7 @@ def test_lines_dists_nowarning():
11961196def test_autoscale ():
11971197 fig , ax = plt .subplots (subplot_kw = {"projection" : "3d" })
11981198 assert ax .get_zscale () == 'linear'
1199+ ax ._view_margin = 0
11991200 ax .margins (x = 0 , y = .1 , z = .2 )
12001201 ax .plot ([0 , 1 ], [0 , 1 ], [0 , 1 ])
12011202 assert ax .get_w_lims () == (0 , 1 , - .1 , 1.1 , - .2 , 1.2 )
@@ -1675,6 +1676,7 @@ def test_colorbar_pos():
16751676def test_inverted_zaxis ():
16761677 fig = plt .figure ()
16771678 ax = fig .add_subplot (projection = '3d' )
1679+ ax .set_zlim (0 , 1 )
16781680 assert not ax .zaxis_inverted ()
16791681 assert ax .get_zlim () == (0 , 1 )
16801682 assert ax .get_zbound () == (0 , 1 )
@@ -1707,17 +1709,17 @@ def test_inverted_zaxis():
17071709def test_set_zlim ():
17081710 fig = plt .figure ()
17091711 ax = fig .add_subplot (projection = '3d' )
1710- assert ax .get_zlim () == ( 0 , 1 )
1712+ assert np . allclose ( ax .get_zlim (), ( - 1 / 48 , 49 / 48 ) )
17111713 ax .set_zlim (zmax = 2 )
1712- assert ax .get_zlim () == ( 0 , 2 )
1714+ assert np . allclose ( ax .get_zlim (), ( - 1 / 48 , 2 ) )
17131715 ax .set_zlim (zmin = 1 )
17141716 assert ax .get_zlim () == (1 , 2 )
17151717
17161718 with pytest .raises (
1717- TypeError , match = "Cannot pass both 'bottom ' and 'zmin '" ):
1719+ TypeError , match = "Cannot pass both 'lower ' and 'min '" ):
17181720 ax .set_zlim (bottom = 0 , zmin = 1 )
17191721 with pytest .raises (
1720- TypeError , match = "Cannot pass both 'top ' and 'zmax '" ):
1722+ TypeError , match = "Cannot pass both 'upper ' and 'max '" ):
17211723 ax .set_zlim (top = 0 , zmax = 1 )
17221724
17231725
@@ -1777,13 +1779,13 @@ def convert_lim(dmin, dmax):
17771779 ("zoom" , MouseButton .LEFT , 'x' , # zoom in
17781780 ((- 0.01 , 0.10 ), (- 0.03 , 0.08 ), (- 0.06 , 0.06 ))),
17791781 ("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 ))),
17811783 ("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 ))),
17831785 ("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 ))),
17851787 ("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 ))),
17871789 ("pan" , MouseButton .LEFT , 'y' ,
17881790 ((0.20 , 0.32 ), (- 0.51 , - 0.39 ), (- 1.27 , - 1.15 )))])
17891791def test_toolbar_zoom_pan (tool , button , key , expected ):
@@ -1968,15 +1970,15 @@ def test_format_coord():
19681970 x = np .arange (10 )
19691971 ax .plot (x , np .sin (x ))
19701972 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 '
19721974 # Modify parameters
19731975 ax .view_init (roll = 30 , vertical_axis = "y" )
19741976 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 '
19761978 # Reset parameters
19771979 ax .view_init ()
19781980 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 '
19801982
19811983
19821984def test_get_axis_position ():
0 commit comments