MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_linestyle

Method set_linestyle

lib/matplotlib/patches.py:507–554  ·  view source on GitHub ↗

Set the patch linestyle. Parameters ---------- ls : {'-', '--', '-.', ':', '', ...} or (offset, on-off-seq) Possible values: - A string: ======================================================= ================ l

(self, ls)

Source from the content-addressed store, hash-verified

505 self.stale = True
506
507 def set_linestyle(self, ls):
508 """
509 Set the patch linestyle.
510
511 Parameters
512 ----------
513 ls : {'-', '--', '-.', ':', '', ...} or (offset, on-off-seq)
514 Possible values:
515
516 - A string:
517
518 ======================================================= ================
519 linestyle description
520 ======================================================= ================
521 ``'-'`` or ``'solid'`` solid line
522 ``'--'`` or ``'dashed'`` dashed line
523 ``'-.'`` or ``'dashdot'`` dash-dotted line
524 ``':'`` or ``'dotted'`` dotted line
525 ``''`` or ``'none'`` (discouraged: ``'None'``, ``' '``) draw nothing
526 ======================================================= ================
527
528 - A tuple describing the start position and lengths of dashes and spaces:
529
530 (offset, onoffseq)
531
532 where
533
534 - *offset* is a float specifying the offset (in points); i.e. how much
535 is the dash pattern shifted.
536 - *onoffseq* is a sequence of on and off ink in points. There can be
537 arbitrary many pairs of on and off values.
538
539 Example: The tuple ``(0, (10, 5, 1, 5))`` means that the pattern starts
540 at the beginning of the line. It draws a 10 point long dash,
541 then a 5 point long space, then a 1 point long dash, followed by a 5 point
542 long space, and then the pattern repeats.
543
544 For examples see :doc:`/gallery/lines_bars_and_markers/linestyles`.
545 """
546 if ls is None:
547 ls = "solid"
548 if ls in [' ', '', 'none']:
549 ls = 'None'
550 self._linestyle = ls
551 self._unscaled_dash_pattern = mlines._get_dash_pattern(ls)
552 self._dash_pattern = mlines._scale_dashes(
553 *self._unscaled_dash_pattern, self._linewidth)
554 self.stale = True
555
556 def set_fill(self, b):
557 """

Callers 2

__init__Method · 0.95
test_default_linestyleFunction · 0.95

Calls

no outgoing calls

Tested by 1

test_default_linestyleFunction · 0.76