@@ -602,26 +602,21 @@ def test_fill_units():
602
602
dt = np .arange ('2009-04-27' , '2009-04-29' , dtype = 'datetime64[D]' )
603
603
dtn = mdates .date2num (dt )
604
604
605
- fig = plt .figure ( )
605
+ fig , (( ax1 , ax2 ), ( ax3 , ax4 )) = plt .subplots ( 2 , 2 )
606
606
607
- # Top-Left
608
- ax1 = fig .add_subplot (221 )
609
607
ax1 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
610
608
ind = [0 , 0 , 1 , 1 ]
611
609
ax1 .fill (dtn [ind ], [0.0 , 0.0 , 90.0 , 0.0 ], 'b' )
612
- # Top-Right
613
- ax2 = fig .add_subplot (222 )
610
+
614
611
ax2 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
615
612
ax2 .fill ([t , t , t + day , t + day ],
616
613
[0.0 , 0.0 , 90.0 , 0.0 ], 'b' )
617
- # Bottom-Left
618
- ax3 = fig .add_subplot (223 )
614
+
619
615
ax3 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
620
616
ax3 .fill (dtn [ind ],
621
617
[0 * units .deg , 0 * units .deg , 90 * units .deg , 0 * units .deg ],
622
618
'b' )
623
- # Bottom-Right
624
- ax4 = fig .add_subplot (224 )
619
+
625
620
ax4 .plot ([t ], [value ], yunits = 'deg' , color = 'red' )
626
621
ax4 .fill ([t , t , t + day , t + day ],
627
622
[0 * units .deg , 0 * units .deg , 90 * units .deg , 0 * units .deg ],
@@ -635,22 +630,16 @@ def test_single_point():
635
630
matplotlib .rcParams ['lines.marker' ] = 'o'
636
631
matplotlib .rcParams ['axes.grid' ] = True
637
632
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' )
644
636
645
637
# Reuse testcase from above for a labeled data test
646
638
data = {'a' : [0 ], 'b' : [1 ]}
647
639
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 )
654
643
655
644
656
645
@image_comparison (['single_date.png' ], style = 'mpl20' )
@@ -721,7 +710,7 @@ def test_axvspan_epoch():
721
710
dt = units .Duration ("ET" , units .day .convert ("sec" ))
722
711
723
712
ax = plt .gca ()
724
- plt .axvspan (t0 , tf , facecolor = "blue" , alpha = 0.25 )
713
+ ax .axvspan (t0 , tf , facecolor = "blue" , alpha = 0.25 )
725
714
ax .set_xlim (t0 - 5.0 * dt , tf + 5.0 * dt )
726
715
727
716
0 commit comments