We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a589856 commit 8c55381Copy full SHA for 8c55381
lib/matplotlib/tests/test_datetime.py
@@ -29,8 +29,20 @@ def test_arrow(self):
29
@pytest.mark.xfail(reason="Test for axhline not written yet")
30
@mpl.style.context("default")
31
def test_axhline(self):
32
- fig, ax = plt.subplots()
33
- ax.axhline(...)
+ mpl.rcParams["date.converter"] = 'concise'
+ fig, ax = plt.subplots(layout='constrained')
34
+ birth_date = np.array([datetime.datetime(2020, 4, 10),
35
+ datetime.datetime(2020, 5, 30),
36
+ datetime.datetime(2020, 10, 12),
37
+ datetime.datetime(2020, 11, 15)])
38
+ year_start = datetime.datetime(2020, 1, 1)
39
+ year_end = datetime.datetime(2020, 12, 31)
40
+ age = [21, 53, 20, 24]
41
+ ax.set_xlabel('Birth Date')
42
+ ax.set_ylabel('Age')
43
+ ax.set_ylim(bottom=year_start, top=year_end)
44
+ ax.bar(x=age, height=birth_date)
45
+ ax.axhline(y=datetime.datetime(2020, 6, 1))
46
47
@pytest.mark.xfail(reason="Test for axhspan not written yet")
48
0 commit comments