@@ -40,10 +40,7 @@ def test_bar3d_shaded():
40
40
41
41
views = [(- 60 , 30 ), (30 , 30 ), (30 , - 30 ), (120 , - 30 )]
42
42
fig = plt .figure (figsize = plt .figaspect (1 / len (views )))
43
- axs = fig .subplots (
44
- 1 , len (views ),
45
- subplot_kw = dict (projection = '3d' )
46
- )
43
+ axs = fig .subplots (1 , len (views ), subplot_kw = dict (projection = '3d' ))
47
44
for ax , (azim , elev ) in zip (axs , views ):
48
45
ax .bar3d (x2d , y2d , x2d * 0 , 1 , 1 , z , shade = True )
49
46
ax .view_init (azim = azim , elev = elev )
@@ -612,7 +609,7 @@ def test_world():
612
609
@image_comparison (['proj3d_lines_dists.png' ],
613
610
remove_text = True , style = 'default' )
614
611
def test_lines_dists ():
615
- fig , ax = plt .subplots (figsize = (4 , 6 ), subplot_kw = dict (aspect = 'equal' ) )
612
+ ax = plt .figure (figsize = (4 , 6 )). add_subplot (aspect = 'equal' )
616
613
617
614
xs = (0 , 30 )
618
615
ys = (20 , 150 )
@@ -634,7 +631,7 @@ def test_lines_dists():
634
631
635
632
636
633
def test_autoscale ():
637
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
634
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
638
635
ax .margins (x = 0 , y = .1 , z = .2 )
639
636
ax .plot ([0 , 1 ], [0 , 1 ], [0 , 1 ])
640
637
assert ax .get_w_lims () == (0 , 1 , - .1 , 1.1 , - .2 , 1.2 )
@@ -671,7 +668,7 @@ def test_invalid_axes_limits(setter, side, value):
671
668
class TestVoxels :
672
669
@image_comparison (['voxels-simple.png' ], remove_text = True )
673
670
def test_simple (self ):
674
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
671
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
675
672
676
673
x , y , z = np .indices ((5 , 4 , 3 ))
677
674
voxels = (x == y ) | (y == z )
@@ -680,7 +677,7 @@ def test_simple(self):
680
677
@image_comparison (['voxels-edge-style.png' ],
681
678
remove_text = True , style = 'default' )
682
679
def test_edge_style (self ):
683
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
680
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
684
681
685
682
x , y , z = np .indices ((5 , 5 , 4 ))
686
683
voxels = ((x - 2 )** 2 + (y - 2 )** 2 + (z - 1.5 )** 2 ) < 2.2 ** 2
@@ -692,7 +689,7 @@ def test_edge_style(self):
692
689
@image_comparison (['voxels-named-colors.png' ], remove_text = True )
693
690
def test_named_colors (self ):
694
691
"""Test with colors set to a 3d object array of strings."""
695
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
692
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
696
693
697
694
x , y , z = np .indices ((10 , 10 , 10 ))
698
695
voxels = (x == y ) | (y == z )
@@ -705,7 +702,7 @@ def test_named_colors(self):
705
702
@image_comparison (['voxels-rgb-data.png' ], remove_text = True )
706
703
def test_rgb_data (self ):
707
704
"""Test with colors set to a 4d float array of rgb data."""
708
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
705
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
709
706
710
707
x , y , z = np .indices ((10 , 10 , 10 ))
711
708
voxels = (x == y ) | (y == z )
@@ -717,7 +714,7 @@ def test_rgb_data(self):
717
714
718
715
@image_comparison (['voxels-alpha.png' ], remove_text = True )
719
716
def test_alpha (self ):
720
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
717
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
721
718
722
719
x , y , z = np .indices ((10 , 10 , 10 ))
723
720
v1 = x == y
@@ -735,7 +732,7 @@ def test_alpha(self):
735
732
736
733
@image_comparison (['voxels-xyz.png' ], tol = 0.01 )
737
734
def test_xyz (self ):
738
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
735
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
739
736
740
737
def midpoints (x ):
741
738
sl = ()
@@ -770,7 +767,7 @@ def test_calling_conventions(self):
770
767
x , y , z = np .indices ((3 , 4 , 5 ))
771
768
filled = np .ones ((2 , 3 , 4 ))
772
769
773
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
770
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
774
771
775
772
# all the valid calling conventions
776
773
for kw in (dict (), dict (edgecolor = 'k' )):
@@ -808,7 +805,7 @@ def test_line3d_set_get_data_3d():
808
805
def test_inverted_cla ():
809
806
# Github PR #5450. Setting autoscale should reset
810
807
# axes to be non-inverted.
811
- fig , ax = plt .subplots ( subplot_kw = { "projection" : " 3d"} )
808
+ ax = plt .figure (). add_subplot ( projection = " 3d" )
812
809
# 1. test that a new axis is not inverted per default
813
810
assert not ax .xaxis_inverted ()
814
811
assert not ax .yaxis_inverted ()
0 commit comments