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

Commitb40f27c

Browse files
authored
Merge pull request#27041 from meeseeksmachine/auto-backport-of-pr-26908-on-v3.8.x
Backport PR#26908 on branch v3.8.x (`allsegs` and `allkinds` return individual segments)
2 parents144765a +6f66c7e commitb40f27c

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
@@ -935,9 +935,11 @@ def __init__(self, ax, *args,
935935
)
936936

937937
allsegs=_api.deprecated("3.8",pending=True)(property(lambdaself: [
938-
p.verticesforcinself.collectionsforpinc.get_paths()]))
938+
[subp.verticesforsubpinp._iter_connected_components()]
939+
forpinself.get_paths()]))
939940
allkinds=_api.deprecated("3.8",pending=True)(property(lambdaself: [
940-
p.codesforcinself.collectionsforpinc.get_paths()]))
941+
[subp.codesforsubpinp._iter_connected_components()]
942+
forpinself.get_paths()]))
941943
tcolors=_api.deprecated("3.8")(property(lambdaself: [
942944
(tuple(rgba),)forrgbainself.to_rgba(self.cvalues,self.alpha)]))
943945
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