@@ -2877,110 +2877,68 @@ def _make_triangulation_data():
28772877 return x , y , z
28782878
28792879
2880- @mpl3d_image_comparison (['scale3d_lines_log.png' ], style = 'mpl20' , tol = 0.03 )
2881- def test_scale3d_lines_log ():
2882- """Test Line3D and Line3DCollection with log scale (plot, wireframe)."""
2883- fig = plt .figure ()
2884-
2885- # Left: regular plot (Line3D)
2886- ax1 = fig .add_subplot (1 , 2 , 1 , projection = '3d' )
2887- x , y , z = _make_log_data ()
2888- ax1 .plot (x , y , z )
2889- ax1 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2890-
2891- # Right: wireframe (Line3DCollection)
2892- ax2 = fig .add_subplot (1 , 2 , 2 , projection = '3d' )
2893- X , Y , Z = _make_surface_log_data ()
2894- ax2 .plot_wireframe (X , Y , Z , rstride = 5 , cstride = 5 )
2895- ax2 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2896-
2897-
2898- @mpl3d_image_comparison (['scale3d_scatter_log.png' ], style = 'mpl20' )
2899- def test_scale3d_scatter_log ():
2900- """Test Path3DCollection with log scale (scatter)."""
2901- fig = plt .figure ()
2902- ax = fig .add_subplot (projection = '3d' )
2903- x , y , z = _make_log_data ()
2904- ax .scatter (x , y , z , c = z , cmap = 'viridis' )
2905- ax .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2906-
2907-
2908- @mpl3d_image_comparison (['scale3d_surface_log.png' ], style = 'mpl20' )
2909- def test_scale3d_surface_log ():
2910- """Test Poly3DCollection with log scale (surface, trisurf)."""
2911- fig = plt .figure ()
2912-
2913- # Left: plot_surface
2914- ax1 = fig .add_subplot (1 , 2 , 1 , projection = '3d' )
2915- X , Y , Z = _make_surface_log_data ()
2916- ax1 .plot_surface (X , Y , Z , cmap = 'viridis' , alpha = 0.8 )
2917- ax1 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2918-
2919- # Right: plot_trisurf
2920- ax2 = fig .add_subplot (1 , 2 , 2 , projection = '3d' )
2921- x , y , z = _make_triangulation_data ()
2922- ax2 .plot_trisurf (x , y , z , cmap = 'viridis' , alpha = 0.8 )
2923- ax2 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2924-
2925-
2926- @mpl3d_image_comparison (['scale3d_bar3d_log.png' ], style = 'mpl20' )
2927- def test_scale3d_bar3d_log ():
2928- """Test bar3d with log scale."""
2929- fig = plt .figure ()
2930- ax = fig .add_subplot (projection = '3d' )
2931-
2932- # Bar positions (in log space, use positive values)
2933- x , y = np .meshgrid ([1 , 10 , 100 ], [1 , 10 , 100 ])
2934- x , y = x .flatten (), y .flatten ()
2935- z = np .ones_like (x , dtype = float )
2936- ax .bar3d (x , y , z , x * 0.3 , y * 0.3 , x * y / 10 , alpha = 0.8 )
2937- ax .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2938-
2939-
2940- @mpl3d_image_comparison (['scale3d_contour_log.png' ], style = 'mpl20' , tol = 0.03 )
2941- def test_scale3d_contour_log ():
2942- """Test contour and contourf with log scale."""
2943- fig = plt .figure ()
2944- X , Y , Z = _make_surface_log_data ()
2945-
2946- # Left: contour (Line3DCollection)
2947- ax1 = fig .add_subplot (1 , 2 , 1 , projection = '3d' )
2948- ax1 .contour (X , Y , Z , levels = 10 )
2949- ax1 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2950-
2951- # Right: contourf (Poly3DCollection)
2952- ax2 = fig .add_subplot (1 , 2 , 2 , projection = '3d' )
2953- ax2 .contourf (X , Y , Z , levels = 10 , alpha = 0.8 )
2954- ax2 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2955-
2956-
2957- @mpl3d_image_comparison (['scale3d_stem_quiver_log.png' ], style = 'mpl20' , tol = 0.03 )
2958- def test_scale3d_stem_quiver_log ():
2959- """Test stem and quiver with log scale."""
2960- fig = plt .figure ()
2961-
2962- # Left: stem
2963- ax1 = fig .add_subplot (1 , 2 , 1 , projection = '3d' )
2964- x , y , z = [1 , 10 , 100 ], [1 , 10 , 100 ], [10 , 100 , 1000 ]
2965- ax1 .stem (x , y , z , bottom = 1 )
2966- ax1 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2967-
2968- # Right: quiver
2969- ax2 = fig .add_subplot (1 , 2 , 2 , projection = '3d' )
2970- x , y , z = np .array ([1 , 10 , 100 ]), np .array ([1 , 10 , 100 ]), np .array ([1 , 10 , 100 ])
2971- ax2 .quiver (x , y , z , x * 0.5 , y * 0.5 , z * 0.5 )
2972- ax2 .set (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2973-
2974-
2975- @mpl3d_image_comparison (['scale3d_text_log.png' ], style = 'mpl20' , remove_text = False )
2976- def test_scale3d_text_log ():
2977- """Test Text3D with log scale."""
2978- fig = plt .figure ()
2979- ax = fig .add_subplot (projection = '3d' )
2880+ @mpl3d_image_comparison (['scale3d_artists_log.png' ], style = 'mpl20' ,
2881+ remove_text = False , tol = 0.03 )
2882+ def test_scale3d_artists_log ():
2883+ """Test all 3D artist types with log scale."""
2884+ fig = plt .figure (figsize = (16 , 12 ))
2885+ log_kw = dict (xscale = 'log' , yscale = 'log' , zscale = 'log' )
2886+ line_data = _make_log_data ()
2887+ surf_X , surf_Y , surf_Z = _make_surface_log_data ()
2888+
2889+ # Row 1: plot, wireframe, scatter, bar3d
2890+ ax = fig .add_subplot (3 , 4 , 1 , projection = '3d' )
2891+ ax .plot (* line_data )
2892+ ax .set (** log_kw , title = 'plot' )
2893+
2894+ ax = fig .add_subplot (3 , 4 , 2 , projection = '3d' )
2895+ ax .plot_wireframe (surf_X , surf_Y , surf_Z , rstride = 5 , cstride = 5 )
2896+ ax .set (** log_kw , title = 'wireframe' )
2897+
2898+ ax = fig .add_subplot (3 , 4 , 3 , projection = '3d' )
2899+ ax .scatter (* line_data , c = line_data [2 ], cmap = 'viridis' )
2900+ ax .set (** log_kw , title = 'scatter' )
2901+
2902+ ax = fig .add_subplot (3 , 4 , 4 , projection = '3d' )
2903+ bx , by = np .meshgrid ([1 , 10 , 100 ], [1 , 10 , 100 ])
2904+ bx , by = bx .flatten (), by .flatten ()
2905+ ax .bar3d (bx , by , np .ones_like (bx , dtype = float ),
2906+ bx * 0.3 , by * 0.3 , bx * by / 10 , alpha = 0.8 )
2907+ ax .set (** log_kw , title = 'bar3d' )
2908+
2909+ # Row 2: surface, trisurf, contour, contourf
2910+ ax = fig .add_subplot (3 , 4 , 5 , projection = '3d' )
2911+ ax .plot_surface (surf_X , surf_Y , surf_Z , cmap = 'viridis' , alpha = 0.8 )
2912+ ax .set (** log_kw , title = 'surface' )
2913+
2914+ ax = fig .add_subplot (3 , 4 , 6 , projection = '3d' )
2915+ tri_data = _make_triangulation_data ()
2916+ ax .plot_trisurf (* tri_data , cmap = 'viridis' , alpha = 0.8 )
2917+ ax .set (** log_kw , title = 'trisurf' )
2918+
2919+ ax = fig .add_subplot (3 , 4 , 7 , projection = '3d' )
2920+ ax .contour (surf_X , surf_Y , surf_Z , levels = 10 )
2921+ ax .set (** log_kw , title = 'contour' )
2922+
2923+ ax = fig .add_subplot (3 , 4 , 8 , projection = '3d' )
2924+ ax .contourf (surf_X , surf_Y , surf_Z , levels = 10 , alpha = 0.8 )
2925+ ax .set (** log_kw , title = 'contourf' )
2926+
2927+ # Row 3: stem, quiver, text
2928+ ax = fig .add_subplot (3 , 4 , 9 , projection = '3d' )
2929+ ax .stem ([1 , 10 , 100 ], [1 , 10 , 100 ], [10 , 100 , 1000 ], bottom = 1 )
2930+ ax .set (** log_kw , title = 'stem' )
2931+
2932+ ax = fig .add_subplot (3 , 4 , 10 , projection = '3d' )
2933+ qxyz = np .array ([1 , 10 , 100 ])
2934+ ax .quiver (qxyz , qxyz , qxyz , qxyz * 0.5 , qxyz * 0.5 , qxyz * 0.5 )
2935+ ax .set (** log_kw , title = 'quiver' )
2936+
2937+ ax = fig .add_subplot (3 , 4 , 11 , projection = '3d' )
29802938 ax .text (1 , 1 , 1 , "Point A" )
29812939 ax .text (10 , 10 , 10 , "Point B" )
29822940 ax .text (100 , 100 , 100 , "Point C" )
2983- ax .set (xscale = 'log' , yscale = 'log' , zscale = 'log ' ,
2941+ ax .set (** log_kw , title = 'text ' ,
29842942 xlim = (0.5 , 200 ), ylim = (0.5 , 200 ), zlim = (0.5 , 200 ))
29852943
29862944
0 commit comments