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

Method set_markevery

lib/matplotlib/lines.py:553–610  ·  view source on GitHub ↗

Set the markevery property to subsample the plot when using markers. e.g., if ``every=5``, every 5-th marker will be plotted. Parameters ---------- every : None or int or (int, int) or slice or list[int] or float or \ (float, float) or list[bool]

(self, every)

Source from the content-addressed store, hash-verified

551 self.stale = True
552
553 def set_markevery(self, every):
554 """
555 Set the markevery property to subsample the plot when using markers.
556
557 e.g., if ``every=5``, every 5-th marker will be plotted.
558
559 Parameters
560 ----------
561 every : None or int or (int, int) or slice or list[int] or float or \
562(float, float) or list[bool]
563 Which markers to plot.
564
565 - ``every=None``: every point will be plotted.
566 - ``every=N``: every N-th marker will be plotted starting with
567 marker 0.
568 - ``every=(start, N)``: every N-th marker, starting at index
569 *start*, will be plotted.
570 - ``every=slice(start, end, N)``: every N-th marker, starting at
571 index *start*, up to but not including index *end*, will be
572 plotted.
573 - ``every=[i, j, m, ...]``: only markers at the given indices
574 will be plotted.
575 - ``every=[True, False, True, ...]``: only positions that are True
576 will be plotted. The list must have the same length as the data
577 points.
578 - ``every=0.1``, (i.e. a float): markers will be spaced at
579 approximately equal visual distances along the line; the distance
580 along the line between markers is determined by multiplying the
581 display-coordinate distance of the Axes bounding-box diagonal
582 by the value of *every*.
583 - ``every=(0.5, 0.1)`` (i.e. a length-2 tuple of float): similar
584 to ``every=0.1`` but the first marker will be offset along the
585 line by 0.5 multiplied by the
586 display-coordinate-diagonal-distance along the line.
587
588 For examples see
589 :doc:`/gallery/lines_bars_and_markers/markevery_demo`.
590
591 Notes
592 -----
593 Setting *markevery* will still only draw markers at actual data points.
594 While the float argument form aims for uniform visual spacing, it has
595 to coerce from the ideal spacing to the nearest available data point.
596 Depending on the number and distribution of data points, the result
597 may still not look evenly spaced.
598
599 When using a start offset to specify the first marker, the offset will
600 be from the first data point which may be different from the first
601 the visible data point if the plot is zoomed in.
602
603 If zooming in on a plot when using float arguments then the actual
604 data points that have markers will change because the distance between
605 markers is always determined from the display-coordinates
606 axes-bounding-box-diagonal regardless of the actual axes data limits.
607
608 """
609 self._markevery = every
610 self.stale = True

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected