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

Commit9001a20

Browse files
committed
Add test to check offset masking in scatter
1 parentd61ceda commit9001a20

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎lib/matplotlib/tests/test_collections.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
importio
22
fromtypesimportSimpleNamespace
3+
fromdatetimeimportdatetime
34

45
importnumpyasnp
56
fromnumpy.testingimportassert_array_equal,assert_array_almost_equal
@@ -1129,3 +1130,22 @@ def test_set_offset_units():
11291130
off0=sc.get_offsets()
11301131
sc.set_offsets(list(zip(y,d)))
11311132
np.testing.assert_allclose(off0,sc.get_offsets())
1133+
1134+
1135+
@image_comparison(baseline_images=["test_check_masked_offsets"],
1136+
extensions=["png"],remove_text=True,style="mpl20")
1137+
deftest_check_masked_offsets():
1138+
# Check if masked data is respected by scatter
1139+
# Ref: Issue #24545
1140+
unmasked_x= [
1141+
datetime(2022,12,15,4,49,52),
1142+
datetime(2022,12,15,4,49,53),
1143+
datetime(2022,12,15,4,49,54),
1144+
datetime(2022,12,15,4,49,55),
1145+
datetime(2022,12,15,4,49,56),
1146+
]
1147+
1148+
masked_y=np.ma.array([1,2,3,4,5],mask=[0,1,1,0,0])
1149+
1150+
fig,ax=plt.subplots()
1151+
ax.scatter(unmasked_x,masked_y)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp