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

Commite9a102f

Browse files
jklymakrcomer
andcommitted
MNT: revert contour deprecations
Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
1 parent25ec2c0 commite9a102f

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations removed in ``contour``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
``contour.allsegs``, ``contour.allkinds``, and ``contour.find_nearest_contour`` are no
5+
longer marked for deprecation.

‎lib/matplotlib/contour.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -930,12 +930,12 @@ def __init__(self, ax, *args,
930930
", ".join(map(repr,kwargs))
931931
)
932932

933-
allsegs=_api.deprecated("3.8",pending=True)(property(lambdaself: [
933+
allsegs=property(lambdaself: [
934934
[subp.verticesforsubpinp._iter_connected_components()]
935-
forpinself.get_paths()]))
936-
allkinds=_api.deprecated("3.8",pending=True)(property(lambdaself: [
935+
forpinself.get_paths()])
936+
allkinds=property(lambdaself: [
937937
[subp.codesforsubpinp._iter_connected_components()]
938-
forpinself.get_paths()]))
938+
forpinself.get_paths()])
939939
tcolors=_api.deprecated("3.8")(property(lambdaself: [
940940
(tuple(rgba),)forrgbainself.to_rgba(self.cvalues,self.alpha)]))
941941
tlinewidths=_api.deprecated("3.8")(property(lambdaself: [
@@ -1389,7 +1389,6 @@ def _find_nearest_contour(self, xy, indices=None):
13891389

13901390
returnidx_level_min,idx_vtx_min,proj_min
13911391

1392-
@_api.deprecated("3.8")
13931392
deffind_nearest_contour(self,x,y,indices=None,pixel=True):
13941393
"""
13951394
Find the point in the contour plot that is closest to ``(x, y)``.

‎lib/matplotlib/tests/test_contour.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -530,23 +530,19 @@ def test_find_nearest_contour():
530530
img=np.exp(-np.pi* (np.sum((xy-5)**2,0)/5.**2))
531531
cs=plt.contour(img,10)
532532

533-
withpytest.warns(mpl._api.MatplotlibDeprecationWarning):
534-
nearest_contour=cs.find_nearest_contour(1,1,pixel=False)
533+
nearest_contour=cs.find_nearest_contour(1,1,pixel=False)
535534
expected_nearest= (1,0,33,1.965966,1.965966,1.866183)
536535
assert_array_almost_equal(nearest_contour,expected_nearest)
537536

538-
withpytest.warns(mpl._api.MatplotlibDeprecationWarning):
539-
nearest_contour=cs.find_nearest_contour(8,1,pixel=False)
537+
nearest_contour=cs.find_nearest_contour(8,1,pixel=False)
540538
expected_nearest= (1,0,5,7.550173,1.587542,0.547550)
541539
assert_array_almost_equal(nearest_contour,expected_nearest)
542540

543-
withpytest.warns(mpl._api.MatplotlibDeprecationWarning):
544-
nearest_contour=cs.find_nearest_contour(2,5,pixel=False)
541+
nearest_contour=cs.find_nearest_contour(2,5,pixel=False)
545542
expected_nearest= (3,0,21,1.884384,5.023335,0.013911)
546543
assert_array_almost_equal(nearest_contour,expected_nearest)
547544

548-
withpytest.warns(mpl._api.MatplotlibDeprecationWarning):
549-
nearest_contour=cs.find_nearest_contour(2,5,indices=(5,7),pixel=False)
545+
nearest_contour=cs.find_nearest_contour(2,5,indices=(5,7),pixel=False)
550546
expected_nearest= (5,0,16,2.628202,5.0,0.394638)
551547
assert_array_almost_equal(nearest_contour,expected_nearest)
552548

@@ -556,16 +552,13 @@ def test_find_nearest_contour_no_filled():
556552
img=np.exp(-np.pi* (np.sum((xy-5)**2,0)/5.**2))
557553
cs=plt.contourf(img,10)
558554

559-
withpytest.warns(mpl._api.MatplotlibDeprecationWarning), \
560-
pytest.raises(ValueError,match="Method does not support filled contours"):
555+
withpytest.raises(ValueError,match="Method does not support filled contours"):
561556
cs.find_nearest_contour(1,1,pixel=False)
562557

563-
withpytest.warns(mpl._api.MatplotlibDeprecationWarning), \
564-
pytest.raises(ValueError,match="Method does not support filled contours"):
558+
withpytest.raises(ValueError,match="Method does not support filled contours"):
565559
cs.find_nearest_contour(1,10,indices=(5,7),pixel=False)
566560

567-
withpytest.warns(mpl._api.MatplotlibDeprecationWarning), \
568-
pytest.raises(ValueError,match="Method does not support filled contours"):
561+
withpytest.raises(ValueError,match="Method does not support filled contours"):
569562
cs.find_nearest_contour(2,5,indices=(2,7),pixel=True)
570563

571564

@@ -825,12 +818,11 @@ def test_allsegs_allkinds():
825818

826819
cs=plt.contour(x,y,z,levels=[0,0.5])
827820

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
821+
# Expect two levels, the first with 5 segments and the second with 4.
822+
forresultin [cs.allsegs,cs.allkinds]:
823+
assertlen(result)==2
824+
assertlen(result[0])==5
825+
assertlen(result[1])==4
834826

835827

836828
deftest_deprecated_apis():

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp