Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3c75cb5 + 2ea2107 commit 2117b5eCopy full SHA for 2117b5e
3 files changed
doc/api/next_api_changes/removals/23076-GL.rst
@@ -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
@@ -1377,7 +1377,7 @@ class LineCollection(Collection):
1377
_edge_default = True
1378
1379
def __init__(self, segments, # Can be None.
1380
- *args, # Deprecated.
+ *,
1381
zorder=2, # Collection.zorder is 1
1382
**kwargs
1383
):
@@ -1413,18 +1413,6 @@ def __init__(self, segments, # Can be None.
1413
1414
Forwarded to `.Collection`.
1415
"""
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
- )
1428
# Unfortunately, mplot3d needs this explicit setting of 'facecolors'.
1429
kwargs.setdefault('facecolors', 'none')
1430
super().__init__(
lib/matplotlib/tests/test_collections.py
@@ -1100,12 +1100,12 @@ def test_color_logic(pcfunc):
1100
1101
1102
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]])
+ lc = LineCollection(None, linewidth=2.2, edgecolor='r',
+ zorder=3, facecolors=[0, 1, 0, 1])
+ assert lc.get_linewidth()[0] == 2.2
+ assert mcolors.same_color(lc.get_edgecolor(), 'r')
+ assert lc.get_zorder() == 3
+ assert mcolors.same_color(lc.get_facecolor(), [[0, 1, 0, 1]])
1109
# To avoid breaking mplot3d, LineCollection internally sets the facecolor
1110
# kwarg if it has not been specified. Hence we need the following test
1111
# for LineCollection._set_default().
0 commit comments