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

Method draw_markers

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

Source from the content-addressed store, hash-verified

704 self.writer.end('a')
705
706 def draw_markers(
707 self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
708 # docstring inherited
709
710 if not len(path.vertices):
711 return
712
713 writer = self.writer
714 path_data = self._convert_path(
715 marker_path,
716 marker_trans + Affine2D().scale(1.0, -1.0),
717 simplify=False)
718 style = self._get_style_dict(gc, rgbFace)
719 dictkey = (path_data, _generate_css(style))
720 oid = self._markers.get(dictkey)
721 style = _generate_css({k: v for k, v in style.items()
722 if k.startswith('stroke')})
723
724 if oid is None:
725 oid = self._make_id('m', dictkey)
726 writer.start('defs')
727 writer.element('path', id=oid, d=path_data, style=style)
728 writer.end('defs')
729 self._markers[dictkey] = oid
730
731 writer.start('g', **self._get_clip_attrs(gc))
732 if gc.get_url() is not None:
733 self.writer.start('a', {'xlink:href': gc.get_url(), 'target': '_blank'})
734 trans_and_flip = self._make_flip_transform(trans)
735 attrib = {'xlink:href': f'#{oid}'}
736 clip = (0, 0, self.width*72, self.height*72)
737 for vertices, code in path.iter_segments(
738 trans_and_flip, clip=clip, simplify=False):
739 if len(vertices):
740 x, y = vertices[-2:]
741 attrib['x'] = _short_float_fmt(x)
742 attrib['y'] = _short_float_fmt(y)
743 attrib['style'] = self._get_style(gc, rgbFace)
744 writer.element('use', attrib=attrib)
745 if gc.get_url() is not None:
746 self.writer.end('a')
747 writer.end('g')
748
749 def draw_path_collection(self, gc, master_transform, paths, all_transforms,
750 offsets, offset_trans, facecolors, edgecolors,

Callers

nothing calls this directly

Calls 15

_convert_pathMethod · 0.95
_get_style_dictMethod · 0.95
_make_idMethod · 0.95
_get_clip_attrsMethod · 0.95
_make_flip_transformMethod · 0.95
_get_styleMethod · 0.95
Affine2DClass · 0.90
_generate_cssFunction · 0.85
_short_float_fmtFunction · 0.85
elementMethod · 0.80
iter_segmentsMethod · 0.80
scaleMethod · 0.45

Tested by

no test coverage detected