Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added test for tricontour#27545

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
szhukovska wants to merge1 commit intomatplotlib:mainfromszhukovska:main
Closed
Changes fromall 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
39 changes: 35 additions & 4 deletionslib/matplotlib/tests/test_datetime.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@

import matplotlib.pyplot as plt
import matplotlib as mpl

import matplotlib.tri as tri

class TestDatetimePlotting:
@mpl.style.context("default")
Expand DownExpand Up@@ -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")
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp