Skip to content
Closed
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
8 changes: 7 additions & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,8 @@ def set_linewidth(self, w):
def set_linestyle(self, style):
"""
Set the linestyle to be one of ('solid', 'dashed', 'dashdot',
'dotted'). One may specify customized dash styles by providing
'dotted') or traditional shortcuts ('-', '--', '-.', ':').
One may specify customized dash styles by providing
a tuple of (offset, dash pairs). For example, the predefiend
linestyles have following values.:

Expand All @@ -1045,6 +1046,11 @@ def set_linestyle(self, style):
'dotted' : (0, (1.0, 3.0)),
"""

# Conversion from usual shortcuts
conversion = {'-': 'solid', '--': 'dashed',
':': 'dotted', '-.': 'dashdot'}
style = conversion.get(style, style)

if style in self.dashd:
offset, dashes = self.dashd[style]
elif isinstance(style, tuple):
Expand Down