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

Method draw_markers

lib/matplotlib/backends/backend_ps.py:621–671  ·  view source on GitHub ↗
(
            self, gc, marker_path, marker_trans, path, trans, rgbFace=None)

Source from the content-addressed store, hash-verified

619
620 @_log_if_debug_on
621 def draw_markers(
622 self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
623 # docstring inherited
624
625 ps_color = (
626 None
627 if self._is_transparent(rgbFace)
628 else f'{_nums_to_str(rgbFace[0])} setgray'
629 if rgbFace[0] == rgbFace[1] == rgbFace[2]
630 else f'{_nums_to_str(*rgbFace[:3])} setrgbcolor')
631
632 # construct the generic marker command:
633
634 # don't want the translate to be global
635 ps_cmd = ['/o {', 'gsave', 'newpath', 'translate']
636
637 lw = gc.get_linewidth()
638 alpha = (gc.get_alpha()
639 if gc.get_forced_alpha() or len(gc.get_rgb()) == 3
640 else gc.get_rgb()[3])
641 stroke = lw > 0 and alpha > 0
642 if stroke:
643 ps_cmd.append('%.1f setlinewidth' % lw)
644 ps_cmd.append(self._linejoin_cmd(gc.get_joinstyle()))
645 ps_cmd.append(self._linecap_cmd(gc.get_capstyle()))
646
647 ps_cmd.append(self._convert_path(marker_path, marker_trans,
648 simplify=False))
649
650 if rgbFace:
651 if stroke:
652 ps_cmd.append('gsave')
653 if ps_color:
654 ps_cmd.extend([ps_color, 'fill'])
655 if stroke:
656 ps_cmd.append('grestore')
657
658 if stroke:
659 ps_cmd.append('stroke')
660 ps_cmd.extend(['grestore', '} bind def'])
661
662 for vertices, code in path.iter_segments(
663 trans,
664 clip=(0, 0, self.width*72, self.height*72),
665 simplify=False):
666 if len(vertices):
667 x, y = vertices[-2:]
668 ps_cmd.append(f"{x:g} {y:g} o")
669
670 ps = '\n'.join(ps_cmd)
671 self._draw_ps(ps, gc, rgbFace, fill=False, stroke=False)
672
673 @_log_if_debug_on
674 def draw_path_collection(self, gc, master_transform, paths, all_transforms,

Callers

nothing calls this directly

Calls 14

_is_transparentMethod · 0.95
_linejoin_cmdMethod · 0.95
_linecap_cmdMethod · 0.95
_convert_pathMethod · 0.95
_draw_psMethod · 0.95
_nums_to_strFunction · 0.85
get_forced_alphaMethod · 0.80
iter_segmentsMethod · 0.80
joinMethod · 0.80
get_linewidthMethod · 0.45
get_alphaMethod · 0.45
get_rgbMethod · 0.45

Tested by

no test coverage detected