Skip to content

Commit 840e4b7

Browse files
Merge pull request #27208 from CozyFrog/tst/axvline
Add test_axvline to test_datetime.py
2 parents 518b268 + d97c8a9 commit 840e4b7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,19 @@ def test_axline(self):
8383
fig, ax = plt.subplots()
8484
ax.axline(...)
8585

86-
@pytest.mark.xfail(reason="Test for axvline not written yet")
8786
@mpl.style.context("default")
8887
def test_axvline(self):
89-
fig, ax = plt.subplots()
90-
ax.axvline(...)
88+
mpl.rcParams["date.converter"] = 'concise'
89+
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout='constrained')
90+
ax1.set_xlim(left=datetime.datetime(2020, 4, 1),
91+
right=datetime.datetime(2020, 8, 1))
92+
ax2.set_xlim(left=np.datetime64('2005-01-01'),
93+
right=np.datetime64('2005-04-01'))
94+
ax3.set_xlim(left=datetime.datetime(2023, 9, 1),
95+
right=datetime.datetime(2023, 11, 1))
96+
ax1.axvline(x=datetime.datetime(2020, 6, 3), ymin=0.5, ymax=0.7)
97+
ax2.axvline(np.datetime64('2005-02-25T03:30'), ymin=0.1, ymax=0.9)
98+
ax3.axvline(x=datetime.datetime(2023, 10, 24), ymin=0.4, ymax=0.7)
9199

92100
@mpl.style.context("default")
93101
def test_axvspan(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy