@@ -3008,6 +3008,43 @@ def test_scale3d_all_scales():
30083008 axs [1 ].set (xlabel = 'asinh' , ylabel = 'linear' , zlabel = 'function' )
30093009
30103010
3011+ @pytest .mark .parametrize ("scale, expected_lims" , [
3012+ ("linear" , (- 0.020833333333333332 , 1.0208333333333333 )),
3013+ ("log" , (0.03640537388223389 , 1.1918138759519783 )),
3014+ ("symlog" , (- 0.020833333333333332 , 1.0208333333333333 )),
3015+ ("logit" , (0.029640777806688817 , 0.9703592221933112 )),
3016+ ("asinh" , (- 0.020833333333333332 , 1.0208333333333333 )),
3017+ ])
3018+ @mpl .style .context ("default" )
3019+ def test_scale3d_default_limits (scale , expected_lims ):
3020+ """Default axis limits on an empty plot should be correct for each scale."""
3021+ fig = plt .figure ()
3022+ ax = fig .add_subplot (projection = '3d' )
3023+ ax .set_xscale (scale )
3024+ ax .set_yscale (scale )
3025+ ax .set_zscale (scale )
3026+ fig .canvas .draw ()
3027+
3028+ for get_lim in (ax .get_xlim , ax .get_ylim , ax .get_zlim ):
3029+ np .testing .assert_allclose (get_lim (), expected_lims )
3030+
3031+
3032+ @check_figures_equal ()
3033+ @pytest .mark .filterwarnings ("ignore:Data has no positive values" )
3034+ def test_scale3d_all_clipped (fig_test , fig_ref ):
3035+ """Fully clipped data (e.g. negative values on log) should look like an empty plot."""
3036+ lims = (0.1 , 10 )
3037+ for ax in [fig_test .add_subplot (projection = '3d' ),
3038+ fig_ref .add_subplot (projection = '3d' )]:
3039+ ax .set_xscale ('log' )
3040+ ax .set_yscale ('log' )
3041+ ax .set_zscale ('log' )
3042+ ax .set (xlim = lims , ylim = lims , zlim = lims )
3043+
3044+ # All negative data — everything is invalid for log scale
3045+ fig_test .axes [0 ].plot ([- 1 , - 2 , - 3 ], [- 4 , - 5 , - 6 ], [- 7 , - 8 , - 9 ])
3046+
3047+
30113048@mpl3d_image_comparison (['scale3d_log_bases.png' ], style = 'mpl20' , remove_text = False )
30123049def test_scale3d_log_bases ():
30133050 """Test log scale with different bases and subs."""
0 commit comments