8000 Merge pull request #21055 from anntzer/mn · matplotlib/matplotlib@20a2bce · GitHub
[go: up one dir, main page]

Skip to content

Commit 20a2bce

Browse files
authored
Merge pull request #21055 from anntzer/mn
Support marker="none" to mean "no marker".
2 parents fcf903d + 3b852ac commit 20a2bce

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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. Using "none" is recommended over using "None", to avoid
5+
confusion with the None object.

lib/matplotlib/legend_handler.py

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 2 deletions
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``.
@@ -200,6 +201,7 @@ class MarkerStyle:
200201
CARETUPBASE: 'caretupbase',
201202
CARETDOWNBASE: 'caretdownbase',
202203
"None": 'nothing',
204+
"none": 'nothing',
203205
None: 'nothing',
204206
' ': 'nothing',
205207
'': 'nothing'
@@ -227,7 +229,7 @@ def __init__(self, marker=_unset, fillstyle=None):
227229
- Another instance of *MarkerStyle* copies the details of that
228230
``marker``.
229231
- *None* means no marker. This is the deprecated default.
230-
- For other possible marker values see the module docstring
232+
- For other possible marker values, see the module docstring
231233
`matplotlib.markers`.
232234
233235
fillstyle : str, default: :rc:`markers.fillstyle`

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 2 deletions
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)
0