@@ -74,11 +74,24 @@ def test_barbs(self):
74
74
fig , ax = plt .subplots ()
75
75
ax .barbs (...)
76
76
77
- @pytest .mark .xfail (reason = "Test for barh not written yet" )
78
77
@mpl .style .context ("default" )
79
78
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 )
82
95
83
96
@pytest .mark .xfail (reason = "Test for boxplot not written yet" )
84
97
@mpl .style .context ("default" )
0 commit comments