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

Commitf7e74da

Browse files
Merge pull request#27024 from kots14/axes-contourf-unit-test-for-issue-26864
Add test_contourf in test_datetime.py
2 parentsdfdb37a +5881a90 commitf7e74da

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

‎lib/matplotlib/tests/test_datetime.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,29 @@ def test_contour(self):
123123
fig,ax=plt.subplots()
124124
ax.contour(...)
125125

126-
@pytest.mark.xfail(reason="Test for contourf not written yet")
127126
@mpl.style.context("default")
128127
deftest_contourf(self):
129-
fig,ax=plt.subplots()
130-
ax.contourf(...)
128+
mpl.rcParams["date.converter"]="concise"
129+
range_threshold=10
130+
fig, (ax1,ax2,ax3)=plt.subplots(3,1,layout="constrained")
131+
132+
x_dates=np.array(
133+
[datetime.datetime(2023,10,delta)fordeltainrange(1,range_threshold)]
134+
)
135+
y_dates=np.array(
136+
[datetime.datetime(2023,10,delta)fordeltainrange(1,range_threshold)]
137+
)
138+
x_ranges=np.array(range(1,range_threshold))
139+
y_ranges=np.array(range(1,range_threshold))
140+
141+
X_dates,Y_dates=np.meshgrid(x_dates,y_dates)
142+
X_ranges,Y_ranges=np.meshgrid(x_ranges,y_ranges)
143+
144+
Z_ranges=np.cos(X_ranges/4)+np.sin(Y_ranges/4)
145+
146+
ax1.contourf(X_dates,Y_dates,Z_ranges)
147+
ax2.contourf(X_dates,Y_ranges,Z_ranges)
148+
ax3.contourf(X_ranges,Y_dates,Z_ranges)
131149

132150
@pytest.mark.xfail(reason="Test for errorbar not written yet")
133151
@mpl.style.context("default")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp