Skip to content

Commit

Permalink
Patch for matplotlib#28123
Browse files Browse the repository at this point in the history
Make Collection.set_linestyle normalize the empty string to 'None', and make Collection._bcast_lwls force linewidths to 0 if the dashes on_off_seq is None.
  • Loading branch information
vegardjervell committed Apr 24, 2024
1 parent eb62d69 commit 0a32091
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ def set_linestyle(self, ls):
':', '', (offset, on-off-seq)}. See `.Line2D.set_linestyle` for a
complete description.
"""
if ls == '':
ls = 'None'
try:
dashes = [mlines._get_dash_pattern(ls)]
except ValueError:
Expand Down Expand Up @@ -705,6 +707,7 @@ def _bcast_lwls(linewidths, dashes):
gcd = math.gcd(l_dashes, l_lw)
dashes = list(dashes) * (l_lw // gcd)
linewidths = list(linewidths) * (l_dashes // gcd)
linewidths = [lw if (dash[1] is not None) else 0 for lw, dash in zip(linewidths, dashes)]

# scale the dash patterns
dashes = [mlines._scale_dashes(o, d, lw)
Expand Down

0 comments on commit 0a32091

Please sign in to comment.