8000 Merge pull request #22931 from larsoner/ls · matplotlib/matplotlib@e73ce5a · GitHub
[go: up one dir, main page]

Skip to content

Commit e73ce5a

Browse files
authored
Merge pull request #22931 from larsoner/ls
BUG: Fix regression with ls=(0, ())
2 parents 4756fa2 + ecfc829 commit e73ce5a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ def set_dashes(self, dash_offset, dash_list):
924924
if np.any(dl < 0.0):
925925
raise ValueError(
926926
"All values in the dash list must be non-negative")
927-
if not np.any(dl > 0.0):
927+
if dl.size and not np.any(dl > 0.0):
928928
raise ValueError(
929929
'At least one value in the dash list must be positive')
930930
self._dashes = dash_offset, dash_list

lib/matplotlib/tests/test_lines.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ def test_valid_colors():
108108
def test_linestyle_variants():
109109
fig, ax = plt.subplots()
110110
for ls in ["-", "solid", "--", "dashed",
111-
"-.", "dashdot", ":", "dotted"]:
111+
"-.", "dashdot", ":", "dotted",
112+
(0, None), (0, ()), (0, []), # gh-22930
113+
]:
112114
ax.plot(range(10), linestyle=ls)
113115
fig.canvas.draw()
114116

0 commit comments

Comments
 (0)
0