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

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions lib/matplotlib/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,29 @@ def test_bar_label(self):
fig, ax = plt.subplots()
ax.bar_label(...)

@pytest.mark.xfail(reason="Test for barbs not written yet")
@mpl.style.context("default")
def test_barbs(self):
fig, ax = plt.subplots()
ax.barbs(...)
plt.rcParams["date.converter"] = 'concise'

start_date = datetime.datetime(2022, 2, 8, 22)
dates = [start_date + datetime.timedelta(hours=i) for i in range(12)]

numbers = np.sin(np.linspace(0, 2 * np.pi, 12))

u = np.ones(12) * 10
v = np.arange(0, 120, 10)

fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 6))

axes[0].barbs(dates, numbers, u, v, length=7)
axes[0].set_title('Datetime vs. Numeric Data')
axes[0].set_xlabel('Datetime')
axes[0].set_ylabel('Numeric Data')

axes[1].barbs(numbers, dates, u, v, length=7)
axes[1].set_title('Numeric vs. Datetime Data')
axes[1].set_xlabel('Numeric Data')
axes[1].set_ylabel('Datetime')

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