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

Commit449cdb7

Browse files
authored
Merge pull request#26908 from rcomer/allsegs
`allsegs` and `allkinds` return individual segments
2 parents71e4be6 +96b0944 commit449cdb7

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

‎lib/matplotlib/contour.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,9 +930,11 @@ def __init__(self, ax, *args,
930930
)
931931

932932
allsegs=_api.deprecated("3.8",pending=True)(property(lambdaself: [
933-
p.verticesforcinself.collectionsforpinc.get_paths()]))
933+
[subp.verticesforsubpinp._iter_connected_components()]
934+
forpinself.get_paths()]))
934935
allkinds=_api.deprecated("3.8",pending=True)(property(lambdaself: [
935-
p.codesforcinself.collectionsforpinc.get_paths()]))
936+
[subp.codesforsubpinp._iter_connected_components()]
937+
forpinself.get_paths()]))
936938
tcolors=_api.deprecated("3.8")(property(lambdaself: [
937939
(tuple(rgba),)forrgbainself.to_rgba(self.cvalues,self.alpha)]))
938940
tlinewidths=_api.deprecated("3.8")(property(lambdaself: [

‎lib/matplotlib/tests/test_contour.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,14 +819,24 @@ def test_all_nan():
819819
2.4e-14,5e-14,7.5e-14,1e-13])
820820

821821

822+
deftest_allsegs_allkinds():
823+
x,y=np.meshgrid(np.arange(0,10,2),np.arange(0,10,2))
824+
z=np.sin(x)*np.cos(y)
825+
826+
cs=plt.contour(x,y,z,levels=[0,0.5])
827+
828+
# Expect two levels, first with 5 segments and the second with 4.
829+
withpytest.warns(PendingDeprecationWarning,match="all"):
830+
forresultin [cs.allsegs,cs.allkinds]:
831+
assertlen(result)==2
832+
assertlen(result[0])==5
833+
assertlen(result[1])==4
834+
835+
822836
deftest_deprecated_apis():
823837
cs=plt.contour(np.arange(16).reshape((4,4)))
824838
withpytest.warns(mpl.MatplotlibDeprecationWarning,match="collections"):
825839
colls=cs.collections
826-
withpytest.warns(PendingDeprecationWarning,match="allsegs"):
827-
assertcs.allsegs== [p.verticesforcincollsforpinc.get_paths()]
828-
withpytest.warns(PendingDeprecationWarning,match="allkinds"):
829-
assertcs.allkinds== [p.codesforcincollsforpinc.get_paths()]
830840
withpytest.warns(mpl.MatplotlibDeprecationWarning,match="tcolors"):
831841
assert_array_equal(cs.tcolors, [c.get_edgecolor()forcincolls])
832842
withpytest.warns(mpl.MatplotlibDeprecationWarning,match="tlinewidths"):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp