MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_barh

Method test_barh

lib/matplotlib/tests/test_datetime.py:206–222  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

204
205 @mpl.style.context("default")
206 def test_barh(self):
207 mpl.rcParams["date.converter"] = 'concise'
208 fig, (ax1, ax2) = plt.subplots(2, 1, layout='constrained')
209 birth_date = np.array([datetime.datetime(2020, 4, 10),
210 datetime.datetime(2020, 5, 30),
211 datetime.datetime(2020, 10, 12),
212 datetime.datetime(2020, 11, 15)])
213 year_start = datetime.datetime(2020, 1, 1)
214 year_end = datetime.datetime(2020, 12, 31)
215 age = [21, 53, 20, 24]
216 ax1.set_xlabel('Age')
217 ax1.set_ylabel('Birth Date')
218 ax1.barh(birth_date, width=age, height=datetime.timedelta(days=10))
219 ax2.set_xlim(left=year_start, right=year_end)
220 ax2.set_xlabel('Birth Date')
221 ax2.set_ylabel('Order of Birth Dates')
222 ax2.barh(np.arange(4), birth_date-year_start, left=year_start)
223
224 @pytest.mark.xfail(reason="Test for boxplot not written yet")
225 @mpl.style.context("default")

Callers

nothing calls this directly

Calls 5

set_xlabelMethod · 0.80
set_ylabelMethod · 0.80
barhMethod · 0.80
subplotsMethod · 0.45
set_xlimMethod · 0.45

Tested by

no test coverage detected