Skip to content

Deprecate the verts kwarg to scatter. #11392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/api/next_api_changes/2018-02-15-AL-deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ The following classes, methods, functions, and attributes are deprecated:

The following rcParams are deprecated:
- ``pgf.debug`` (the pgf backend relies on logging),

The following keyword arguments are deprecated:
- passing ``verts`` to ``scatter`` (use ``marker`` instead),
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/scatter_custom_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
s *= 10**2.

fig, ax = plt.subplots()
ax.scatter(x, y, s, c, marker=None, verts=verts)
ax.scatter(x, y, s, c, marker=verts)

plt.show()
4 changes: 1 addition & 3 deletions examples/lines_bars_and_markers/scatter_star_poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

verts = np.array([[-1, -1], [1, -1], [1, 1], [-1, -1]])
plt.subplot(323)
plt.scatter(x, y, s=80, c=z, marker=(verts, 0))
# equivalent:
# plt.scatter(x, y, s=80, c=z, marker=None, verts=verts)
plt.scatter(x, y, s=80, c=z, marker=verts)

plt.subplot(324)
plt.scatter(x, y, s=80, c=z, marker=(5, 1))
Expand Down
13 changes: 5 additions & 8 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3818,11 +3818,6 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
is 'face'. You may want to change this as well.
If *None*, defaults to rcParams ``lines.linewidth``.

verts : sequence of (x, y), optional
If *marker* is *None*, these vertices will be used to construct
the marker. The center of the marker is located at (0, 0) in
normalized units. The overall marker is rescaled by *s*.

edgecolors : color or sequence of color, optional, default: 'face'
The edge color of the marker. Possible values:

Expand Down Expand Up @@ -3960,9 +3955,11 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
scales = s # Renamed for readability below.

# to be API compatible
if marker is None and verts is not None:
marker = (verts, 0)
verts = None
if verts is not None:
cbook.warn_deprecated("3.0", name="'verts'", obj_type="kwarg",
alternative="'marker'")
if marker is None:
marker = verts

# load default marker from rcParams
if marker is None:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ def test_scatter_marker():
c=[(1, 0, 0), 'y', 'b', 'lime'],
s=[60, 50, 40, 30],
edgecolors=['k', 'r', 'g', 'b'],
verts=verts)
marker=verts)


@image_comparison(baseline_images=['scatter_2D'], remove_text=True,
Expand Down