diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index b19124a1b764..08ad2966a91d 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -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):
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: