Skip to content

Commit cf2d9c9

Browse files
committed
add quiverkey datetime test
1 parent f3585ef commit cf2d9c9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,22 @@ def test_quiver(self):
520520
fig, ax = plt.subplots()
521521
ax.quiver(...)
522522

523-
@pytest.mark.xfail(reason="Test for quiverkey not written yet")
524523
@mpl.style.context("default")
525524
def test_quiverkey(self):
526-
fig, ax = plt.subplots()
527-
ax.quiverkey(...)
525+
mpl.rcParams["date.converter"] = 'concise'
526+
x = np.arange(np.datetime64('2023-12-01'), np.datetime64('2023-12-06'))
527+
y = 10 ** np.arange(5)
528+
u = np.sin(np.arange(len(x)))
529+
v = np.cos(np.arange(len(x)))
530+
fig, ax = plt.subplots(figsize=(10, 6))
531+
ax.set_title('Quiverplot with Datetime')
532+
ax.set_xlabel('Date')
533+
ax.set_ylabel('Y-axis')
534+
q = ax.quiver(x, y, u, v, scale=20)
535+
ax.quiverkey(q, .085, .05, 1, x[0], labelpos='N', coordinates='figure')
536+
ax.quiverkey(q, .085, .92, 1, x[1], labelpos='S', coordinates='figure')
537+
ax.quiverkey(q, .85, .05, 1, x[2], labelpos='W', coordinates='figure')
538+
ax.quiverkey(q, .8, .9, 1, x[3], labelpos='E', coordinates='figure')
528539

529540
@mpl.style.context("default")
530541
def test_scatter(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