Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add test_quiver in test_datetime.py #27547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
21 changes: 18 additions & 3 deletions lib/matplotlib/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,26 @@ def test_plot_date(self):
ax2.plot_date(x_dates, y_ranges)
ax3.plot_date(x_ranges, y_dates)

@pytest.mark.xfail(reason="Test for quiver not written yet")
@mpl.style.context("default")
def test_quiver(self):
fig, ax = plt.subplots()
ax.quiver(...)
threshold = 10
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained")

x_dates = np.array(
[datetime.datetime(2024, 1, 1+delta) for delta in range(threshold)]
)
y_dates = np.array(
[datetime.datetime(2024, 2, 1+delta) for delta in range(threshold)]
)
x_ranges = np.arange(threshold)
y_ranges = np.arange(threshold)

U = np.sin(np.arange(len(x_dates)))
V = np.cos(np.arange(len(y_dates)))

ax1.quiver(x_dates, y_ranges, U, V, scale=20)
ax2.quiver(x_ranges, y_dates, U, V, scale=20)
ax3.quiver(x_dates, y_dates, U, V, scale=20)

@mpl.style.context("default")
def test_scatter(self):
Expand Down