8000 Correct parameter name to match documentation in Line2D.set_linestyle · matplotlib/matplotlib@937248d · GitHub
[go: up one dir, main page]

Skip to content

Commit 937248d

Browse files
committed
Correct parameter name to match documentation in Line2D.set_linestyle
1 parent 7858040 commit 937248d

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/matplotlib/lines.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ def set_linewidth(self, w):
921921
"""
922922
self._linewidth = w
923923

924-
def set_linestyle(self, linestyle):
924+
def set_linestyle(self, ls):
925925
"""
926926
Set the linestyle of the line (also accepts drawstyles,
927927
e.g., ``'steps--'``)
@@ -959,36 +959,36 @@ def set_linestyle(self, linestyle):
959959
ls : { '-', '--', '-.', ':'} and more see description
960960
The line style.
961961
"""
962-
if not is_string_like(linestyle):
963-
if len(linestyle) != 2:
962+
if not is_string_like(ls):
963+
if len(ls) != 2:
964964
raise ValueError()
965965

966-
self.set_dashes(linestyle[1])
966+
self.set_dashes(ls[1])
967967
self._linestyle = "--"
968968
return
969969

970970
for ds in self.drawStyleKeys: # long names are first in the list
971-
if linestyle.startswith(ds):
971+
if ls.startswith(ds):
972972
self.set_drawstyle(ds)
973-
if len(linestyle) > len(ds):
974-
linestyle = linestyle[len(ds):]
973+
if len(ls) > len(ds):
974+
ls = ls[len(ds):]
975975
else:
976-
linestyle = '-'
976+
ls = '-'
977977
break
978978

979-
if linestyle in [' ', '', 'none']:
980-
linestyle = 'None'
979+
if ls in [' ', '', 'none']:
980+
ls = 'None'
981981

982-
if linestyle not in self._lineStyles:
982+
if ls not in self._lineStyles:
983983
try:
984-
linestyle = ls_mapper_r[linestyle]
984+
ls = ls_mapper_r[ls]
985985
except KeyError:
986986
raise ValueError(("You passed in an invalid linestyle, "
987987
"`{}`. See "
988988
"docs of Line2D.set_linestyle for "
989-
"valid values.").format(linestyle))
989+
"valid values.").format(ls))
990990

991-
self._linestyle = linestyle
991+
self._linestyle = ls
992992

993993
@docstring.dedent_interpd
994994
def set_marker(self, marker):

0 commit comments

Comments
 (0)
0