Skip to content
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
2 changes: 1 addition & 1 deletion lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _get_dash_pattern(style):
if isinstance(style, str):
style = ls_mapper.get(style, style)
# un-dashed styles
if style in ['solid', 'None']:
if style in ['solid', 'None', 'none', '', ' ']:
offset = 0
dashes = None
# dashed styles
Expand Down
11 changes: 11 additions & 0 deletions lib/matplotlib/tests/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,17 @@ def test_set_wrong_linestyle():
c.set_linestyle('fuzzy')


@pytest.mark.parametrize('ls', ['', ' ', 'none'])
def test_scatter_empty_linestyle_pdf(ls):
# Regression test: '', ' ', and 'none' are documented "draw nothing"
# linestyle aliases but were not recognized by _get_dash_pattern, causing
# savefig to PDF to crash with "zero-size array to reduction operation maximum".
plt.switch_backend('pdf')
fig, ax = plt.subplots()
ax.scatter([0, 1], [0, 1], ls=ls)
fig.savefig(io.BytesIO())


@mpl.style.context('default')
def test_capstyle():
col = mcollections.PathCollection([])
Expand Down
Loading