Skip to content

Commit bf547db

Browse files
committed
Support marker="none" to mean "no marker".
As for other APIs, this is less likely to be confused with the None object.
1 parent 65cf35b commit bf547db

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``marker`` can now be set to the string "none"
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... to mean "no-marker", consistently with other APIs which support the
4+
lowercase version.

lib/matplotlib/legend_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def create_artists(self, legend, orig_handle,
566566
self.update_prop(legline, plotlines, legend)
567567

568568
legline.set_drawstyle('default')
569-
legline.set_marker('None')
569+
legline.set_marker('none')
570570

571571
self.update_prop(legline_marker, plotlines, legend)
572572
legline_marker.set_linestyle('None')

lib/matplotlib/markers.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
``9`` (``CARETRIGHTBASE``) |m34| caretright (centered at base)
4646
``10`` (``CARETUPBASE``) |m35| caretup (centered at base)
4747
``11`` (``CARETDOWNBASE``) |m36| caretdown (centered at base)
48-
``"None"``, ``" "`` or ``""`` nothing
48+
``"None"`` or ``"None"`` nothing
49+
``" "`` or ``""`` nothing
4950
``'$...$'`` |m37| Render the string using mathtext.
5051
E.g ``"$f$"`` for marker showing the
5152
letter ``f``.
@@ -199,6 +200,7 @@ class MarkerStyle:
199200
CARETUPBASE: 'caretupbase',
200201
CARETDOWNBASE: 'caretdownbase',
201202
"None": 'nothing',
203+
"none": 'nothing',
202204
None: 'nothing',
203205
' ': 'nothing',
204206
'': 'nothing'
@@ -223,8 +225,7 @@ def __init__(self, marker=None, fillstyle=None):
223225
marker : str, array-like, Path, MarkerStyle, or None, default: None
224226
- Another instance of *MarkerStyle* copies the details of that
225227
``marker``.
226-
- *None* means no marker.
227-
- For other possible marker values see the module docstring
228+
- For other possible marker values, see the module docstring
228229
`matplotlib.markers`.
229230
230231
fillstyle : str, default: 'full'

lib/matplotlib/tests/test_axes.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -4117,8 +4117,9 @@ def test_eventplot_orientation(data, orientation):
41174117
@image_comparison(['marker_styles.png'], remove_text=True)
41184118
def test_marker_styles():
41194119
fig, ax = plt.subplots()
4120-
for y, marker in enumerate(sorted(matplotlib.markers.MarkerStyle.markers,
4121-
key=lambda x: str(type(x))+str(x))):
4120+
for y, marker in enumerate(sorted(
4121+
{*matplotlib.markers.MarkerStyle.markers} - {"none"},
4122+
key=lambda x: str(type(x))+str(x))):
41224123
ax.plot((y % 2)*5 + np.arange(10)*10, np.ones(10)*10*y, linestyle='',
41234124
marker=marker, markersize=10+y/5, label=marker)
41244125

0 commit comments

Comments
 (0)