@@ -74,11 +74,24 @@ def test_barbs(self):
7474 fig , ax = plt .subplots ()
7575 ax .barbs (...)
7676
77- @pytest .mark .xfail (reason = "Test for barh not written yet" )
7877 @mpl .style .context ("default" )
7978 def test_barh (self ):
80- fig , ax = plt .subplots ()
81- ax .barh (...)
79+ mpl .rcParams ["date.converter" ] = 'concise'
80+ fig , (ax1 , ax2 ) = plt .subplots (2 , 1 , layout = 'constrained' )
81+ birth_date = np .array ([datetime .datetime (2020 , 4 , 10 ),
82+ datetime .datetime (2020 , 5 , 30 ),
83+ datetime .datetime (2020 , 10 , 12 ),
84+ datetime .datetime (2020 , 11 , 15 )])
85+ year_start = datetime .datetime (2020 , 1 , 1 )
86+ year_end = datetime .datetime (2020 , 12 , 31 )
87+ age = [21 , 53 , 20 , 24 ]
88+ ax1 .set_xlabel ('Age' )
89+ ax1 .set_ylabel ('Birth Date' )
90+ ax1 .barh (birth_date , width = age , height = datetime .timedelta (days = 10 ))
91+ ax2 .set_xlim (left = year_start , right = year_end )
92+ ax2 .set_xlabel ('Birth Date' )
93+ ax2 .set_ylabel ('Order of Birth Dates' )
94+ ax2 .barh (np .arange (4 ), birth_date - year_start , left = year_start )
8295
8396 @pytest .mark .xfail (reason = "Test for boxplot not written yet" )
8497 @mpl .style .context ("default" )
0 commit comments