8000 MNT: Remove positional argument handling in LineCollection · matplotlib/matplotlib@2ea2107 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ea2107

Browse files
committed
MNT: Remove positional argument handling in LineCollection
This follows the deprecation period.
1 parent 65e9204 commit 2ea2107

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Passing positional arguments to LineCollection has been removed
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Use specific keyword argument names now.

lib/matplotlib/collections.py

Lines changed: 1 addition & 13 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ class LineCollection(Collection):
13771377
_edge_default = True
13781378

13791379
def __init__(self, segments, # Can be None.
1380-
*args, # Deprecated.
1380+
*,
13811381
zorder=2, # Collection.zorder is 1
13821382
**kwargs
13831383
):
@@ -1413,18 +1413,6 @@ def __init__(self, segments, # Can be None.
14131413
**kwargs
14141414
Forwarded to `.Collection`.
14151415
"""
1416-
argnames = ["linewidths", "colors", "antialiaseds", "linestyles",
1417-
"offsets", "transOffset", "norm", "cmap", "pickradius",
1418-
"zorder", "facecolors"]
1419-
if args:
1420-
argkw = {name: val for name, val in zip(argnames, args)}
1421-
kwargs.update(argkw)
1422-
_api.warn_deprecated(
1423-
"3.4", message="Since %(since)s, passing LineCollection "
1424-
"arguments other than the first, 'segments', as positional "
1425-
"arguments is deprecated, and they will become keyword-only "
1426-
"arguments %(removal)s."
1427-
)
14281416
# Unfortunately, mplot3d needs this explicit setting of 'facecolors'.
14291417
kwargs.setdefault('facecolors', 'none')
14301418
super().__init__(

lib/matplotlib/tests/test_collections.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,12 +1100,12 @@ def test_color_logic(pcfunc):
11001100

11011101

11021102
def test_LineCollection_args():
1103-
with pytest.warns(MatplotlibDeprecationWarning):
1104-
lc = LineCollection(None, 2.2, 'r', zorder=3, facecolors=[0, 1, 0, 1])
1105-
assert lc.get_linewidth()[0] == 2.2
1106-
assert mcolors.same_color(lc.get_edgecolor(), 'r')
1107-
assert lc.get_zorder() == 3
1108-
assert mcolors.same_color(lc.get_facecolor(), [[0, 1, 0, 1]])
1103+
lc = LineCollection(None, linewidth=2.2, edgecolor='r',
1104+
zorder=3, facecolors=[0, 1, 0, 1])
1105+
assert lc.get_linewidth()[0] == 2.2
1106+
assert mcolors.same_color(lc.get_edgecolor(), 'r')
1107+
assert lc.get_zorder() == 3
1108+
assert mcolors.same_color(lc.get_facecolor(), [[0, 1, 0, 1]])
11091109
# To avoid breaking mplot3d, LineCollection internally sets the facecolor
11101110
# kwarg if it has not been specified. Hence we need the following test
11111111
# for LineCollection._set_default().

0 commit comments

Comments
 (0)
0