Skip to content

Deprecate certain marker styles that have simpler synonyms. #11099

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
Apr 22, 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
8 changes: 8 additions & 0 deletions doc/api/next_api_changes/2018-04-22-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Deprecation of certain marker styles
````````````````````````````````````

Using ``(n, 3)`` as marker style to specify a circle marker is deprecated. Use
``"o"`` instead.

Using ``([(x0, y0), (x1, y1), ...], 0)`` as marker style to specify a custom
marker path is deprecated. Use ``[(x0, y0), (x1, y1), ...]`` instead.
6 changes: 3 additions & 3 deletions examples/api/scatter_piecharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
s3 = np.abs(xy3).max()

fig, ax = plt.subplots()
ax.scatter(range(3), range(3), marker=(xy1, 0),
ax.scatter(range(3), range(3), marker=xy1,
s=s1 ** 2 * sizes, facecolor='blue')
ax.scatter(range(3), range(3), marker=(xy2, 0),
ax.scatter(range(3), range(3), marker=xy2,
s=s2 ** 2 * sizes, facecolor='green')
ax.scatter(range(3), range(3), marker=(xy3, 0),
ax.scatter(range(3), range(3), marker=xy3,
s=s3 ** 2 * sizes, facecolor='red')

plt.show()
16 changes: 12 additions & 4 deletions lib/matplotlib/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@
an asterisk
3
a circle (`numsides` and `angle` is
ignored)
ignored); deprecated.

`angle`:
the angle of rotation of the symbol
============================== ===============================================

For backward compatibility, the form (`verts`, 0) is also accepted,
but it is equivalent to just `verts` for giving a raw set of vertices
that define the shape.
For backward compatibility, the form (`verts`, 0) is also accepted, but it is
deprecated and equivalent to just `verts` for giving a raw set of vertices that
define the shape.

`None` is the default which means 'nothing', however this table is
referred to from other docs for the valid inputs from marker inputs and in
Expand Down Expand Up @@ -307,9 +307,17 @@ def _set_tuple_marker(self):
self._filled = False
self._joinstyle = 'bevel'
elif symstyle == 3:
cbook.warn_deprecated(
"3.0", "Setting a circle marker using `(..., 3)` is "
"deprecated since Matplotlib 3.0, and support for it will "
"be removed in 3.2. Directly pass 'o' instead.")
self._path = Path.unit_circle()
self._transform = Affine2D().scale(0.5).rotate_deg(rotation)
else:
cbook.warn_deprecated(
"3.0", "Passing vertices as `(verts, 0)` is deprecated since "
"Matplotlib 3.0, and support for it will be removed in 3.2. "
"Directly pass `verts` instead.")
verts = np.asarray(marker[0])
path = Path(verts)
self._set_custom_marker(path)
Expand Down