@@ -602,26 +602,21 @@ def test_fill_units():
602602 dt = np .arange ('2009-04-27' , '2009-04-29' , dtype = 'datetime64[D]' )
603603 dtn = mdates .date2num (dt )
604604
605- fig = plt .figure ( )
605+ fig , (( ax1 , ax2 ), ( ax3 , ax4 )) = plt .subplots ( 2 , 2 )
606606
607- # Top-Left
608- ax1 = fig .add_subplot (221 )
609607 ax1 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
610608 ind = [0 , 0 , 1 , 1 ]
611609 ax1 .fill (dtn [ind ], [0.0 , 0.0 , 90.0 , 0.0 ], 'b' )
612- # Top-Right
613- ax2 = fig .add_subplot (222 )
610+
614611 ax2 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
615612 ax2 .fill ([t , t , t + day , t + day ],
616613 [0.0 , 0.0 , 90.0 , 0.0 ], 'b' )
617- # Bottom-Left
618- ax3 = fig .add_subplot (223 )
614+
619615 ax3 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
620616 ax3 .fill (dtn [ind ],
621617 [0 * units .deg , 0 * units .deg , 90 * units .deg , 0 * units .deg ],
622618 'b' )
623- # Bottom-Right
624- ax4 = fig .add_subplot (224 )
619+
625620 ax4 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
626621 ax4 .fill ([t , t , t + day , t + day ],
627622 [0 * units .deg , 0 * units .deg , 90 * units .deg , 0 * units .deg ],
@@ -635,22 +630,16 @@ def test_single_point():
635630 matplotlib .rcParams ['lines.marker' ] = 'o'
636631 matplotlib .rcParams ['axes.grid' ] = True
637632
638- plt .figure ()
639- plt .subplot (211 )
640- plt .plot ([0 ], [0 ], 'o' )
641-
642- plt .subplot (212 )
643- plt .plot ([1 ], [1 ], 'o' )
633+ fig , (ax1 , ax2 ) = plt .subplots (2 )
634+ ax1 .plot ([0 ], [0 ], 'o' )
635+ ax2 .plot ([1 ], [1 ], 'o' )
644636
645637 # Reuse testcase from above for a labeled data test
646638 data = {'a' : [0 ], 'b' : [1 ]}
647639
648- plt .figure ()
649- plt .subplot (211 )
650- plt .plot ('a' , 'a' , 'o' , data = data )
651-
652- plt .subplot (212 )
653- plt .plot ('b' , 'b' , 'o' , data = data )
640+ fig , (ax1 , ax2 ) = plt .subplots (2 )
641+ ax1 .plot ('a' , 'a' , 'o' , data = data )
642+ ax2 .plot ('b' , 'b' , 'o' , data = data )
654643
655644
656645@image_comparison (['single_date.png' ], style = 'mpl20' )
@@ -721,7 +710,7 @@ def test_axvspan_epoch():
721710 dt = units .Duration ("ET" , units .day .convert ("sec" ))
722711
723712 ax = plt .gca ()
724- plt .axvspan (t0 , tf , facecolor = "blue" , alpha = 0.25 )
713+ ax .axvspan (t0 , tf , facecolor = "blue" , alpha = 0.25 )
725714 ax .set_xlim (t0 - 5.0 * dt , tf + 5.0 * dt )
726715
727716
0 commit comments