Skip to content

Commit 587cfd7

Browse files
committed
Add new documentation for set_linestyle of patches, collection and lines.
1 parent e918cb8 commit 587cfd7

File tree

3 files changed

+66
-21
lines changed

3 files changed

+66
-21
lines changed

lib/matplotlib/collections.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,26 @@ def set_linestyle(self, ls):
463463
"""
464464
Set the linestyle(s) for the collection.
465465
466-
ACCEPTS: ['solid' | 'dashed', 'dashdot', 'dotted' |
467-
(offset, on-off-dash-seq) ]
466+
=========================== =================
467+
linestyle description
468+
=========================== =================
469+
``'-'`` or ``'solid'`` solid line
470+
``'--'`` or ``'dashed'`` dashed line
471+
``'-.'`` or ``'dash_dot'`` dash-dotted line
472+
``':'`` or ``'dotted'`` dotted line
473+
=========================== =================
474+
475+
Alternatively a dash tuple of the following form can be provided::
476+
477+
(offset, onoffseq),
478+
479+
where ``onoffseq`` is an even length tuple of on and off ink
480+
in points.
481+
482+
Parameters
483+
----------
484+
ls : { '-', '--', '-.', ':'} and more see description
485+
The line style.
468486
"""
469487
try:
470488
dashd = backend_bases.GraphicsContextBase.dashd

lib/matplotlib/lines.py

+26-18
Original file line numberDiff line numberDiff line change
@@ -918,33 +918,41 @@ def set_linewidth(self, w):
918918

919919
def set_linestyle(self, linestyle):
920920
"""
921-
Set the linestyle of the line (also accepts drawstyles)
922-
923-
924-
================ =================
925-
linestyle description
926-
================ =================
927-
``'-'`` solid
928-
``'--'`` dashed
929-
``'-.'`` dash_dot
930-
``':'`` dotted
931-
``'None'`` draw nothing
932-
``' '`` draw nothing
933-
``''`` draw nothing
934-
================ =================
921+
Set the linestyle of the line (also accepts drawstyles,
922+
e.g., ``'steps--'``)
923+
924+
925+
=========================== =================
926+
linestyle description
927+
=========================== =================
928+
``'-'`` or ``'solid'`` solid line
929+
``'--'`` or ``'dashed'`` dashed line
930+
``'-.'`` or ``'dash_dot'`` dash-dotted line
931+
``':'`` or ``'dotted'`` dotted line
932+
``'None'`` draw nothing
933+
``' '`` draw nothing
934+
``''`` draw nothing
935+
=========================== =================
935936
936937
'steps' is equivalent to 'steps-pre' and is maintained for
937938
backward-compatibility.
938939
940+
Alternatively a dash tuple of the following form can be provided::
941+
942+
(offset, onoffseq),
943+
944+
where ``onoffseq`` is an even length tuple of on and off ink
945+
in points.
946+
939947
.. seealso::
940948
941949
:meth:`set_drawstyle`
942950
To set the drawing style (stepping) of the plot.
943951
944-
ACCEPTS: [``'-'`` | ``'--'`` | ``'-.'`` | ``':'`` | ``'None'`` |
945-
``' '`` | ``''``]
946-
947-
and any drawstyle in combination with a linestyle, e.g., ``'steps--'``.
952+
Parameters
953+
----------
954+
ls : { '-', '--', '-.', ':'} and more see description
955+
The line style.
948956
"""
949957
if not is_string_like(linestyle):
950958
if len(linestyle) != 2:

lib/matplotlib/patches.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,26 @@ def set_linestyle(self, ls):
339339
"""
340340
Set the patch linestyle
341341
342-
ACCEPTS: ['solid' | 'dashed' | 'dashdot' | 'dotted']
342+
=========================== =================
343+
linestyle description
344+
=========================== =================
345+
``'-'`` or ``'solid'`` solid line
346+
``'--'`` or ``'dashed'`` dashed line
347+
``'-.'`` or ``'dash_dot'`` dash-dotted line
348+
``':'`` or ``'dotted'`` dotted line
349+
=========================== =================
350+
351+
Alternatively a dash tuple of the following form can be provided::
352+
353+
(offset, onoffseq),
354+
355+
where ``onoffseq`` is an even length tuple of on and off ink
356+
in points.
357+
358+
Parameters
359+
----------
360+
ls : { '-', '--', '-.', ':'} and more see description
361+
The line style.
343362
"""
344363
if ls is None:
345364
ls = "solid"

0 commit comments

Comments
 (0)