diff --git a/lib/matplotlib/tests/test_datetime.py b/lib/matplotlib/tests/test_datetime.py index 104a649e1464..b97cac97af5f 100644 --- a/lib/matplotlib/tests/test_datetime.py +++ b/lib/matplotlib/tests/test_datetime.py @@ -5,7 +5,7 @@ import matplotlib.pyplot as plt import matplotlib as mpl - +import matplotlib.tri as tri class TestDatetimePlotting: @mpl.style.context("default") @@ -805,11 +805,42 @@ def test_text(self): ax3.plot(x_dates, y_dates) ax3.text(test_date, test_date, "Inserted Text", **font_properties) - @pytest.mark.xfail(reason="Test for tricontour not written yet") @mpl.style.context("default") def test_tricontour(self): - fig, ax = plt.subplots() - ax.tricontour(...) + + # make unequailly distributed data points: + + dates = np.arange(np.datetime64('2022-01-01'), np.datetime64('2022-12-28'), + np.timedelta64(1,'D')) + n = len(dates) + np.random.seed(19680801) + indx = np.array(np.random.random_sample(n//2)*n, dtype='int') + np.random.seed(100) + indy = np.array(np.random.random_sample(n//2)*n, dtype='int') + x = indx - n/2. + y = indy - n/2. + z = x**2 + y**2 - x/4. + levels = np.linspace(z.min(), z.max(), 5) + dates_x = dates[indx] + dates_y = dates[indy] + + # plot: + fig, (ax0, ax1, ax2) = plt.subplots(1,3, figsize=(20, 5)) + # dates on y axis + ax0.plot(x, dates_y, 'o', markersize=2, color='lightgrey') + ax0.tricontour(x, dates_y, z, levels=levels) + ax0.tick_params('y',labelrotation=45) + # dates on x axis + ax1.plot(dates_x, y, 'o', markersize=2, color='lightgrey') + ax1.tricontour(dates_x, y, z, levels=levels) + ax1.tick_params('x',labelrotation=45) + # dates on x and y axes + ax2.plot(dates_x, dates_y, 'o', markersize=2, color='lightgrey') + ax2.tricontour(dates_x, dates_y, z, levels=levels) + ax2.tick_params(labelrotation=45) + + fig.tight_layout() + plt.show() @pytest.mark.xfail(reason="Test for tricontourf not written yet") @mpl.style.context("default") 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