8000 BUG: Fix regression with ls=(0, ()) by larsoner · Pull Request #22931 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix regression with ls=(0, ()) #22931

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 28, 2022
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/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ def set_dashes(self, dash_offset, dash_list):
if np.any(dl < 0.0):
raise ValueError(
"All values in the dash list must be non-negative")
if not np.any(dl > 0.0):
if dl.size and not np.any(dl > 0.0):
raise ValueError(
'At least one value in the dash list must be positive')
self._dashes = dash_offset, dash_list
Expand Down
4 changes: 3 additions & 1 deletion lib/matplotlib/tests/test_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def test_valid_colors():
def test_linestyle_variants():
fig, ax = plt.subplots()
for ls in ["-", "solid", "--", "dashed",
"-.", "dashdot", ":", "dotted"]:
"-.", "dashdot", ":", "dotted",
(0, None), (0, ()), (0, []), # gh-22930
]:
ax.plot(range(10), linestyle=ls)
fig.canvas.draw()

Expand Down
0