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

Method _write_clips

lib/matplotlib/backends/backend_svg.py:641–662  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

639 return {'clip-path': f'url(#{oid})'}
640
641 def _write_clips(self):
642 if not len(self._clipd):
643 return
644 writer = self.writer
645 writer.start('defs')
646 for clip, oid in self._clipd.values():
647 writer.start('clipPath', id=oid)
648 if len(clip) == 2:
649 clippath, clippath_trans = clip
650 path_data = self._convert_path(
651 clippath, clippath_trans, simplify=False)
652 writer.element('path', d=path_data)
653 else:
654 x, y, w, h = clip
655 writer.element(
656 'rect',
657 x=_short_float_fmt(x),
658 y=_short_float_fmt(y),
659 width=_short_float_fmt(w),
660 height=_short_float_fmt(h))
661 writer.end('clipPath')
662 writer.end('defs')
663
664 def open_group(self, s, gid=None):
665 # docstring inherited

Callers 1

finalizeMethod · 0.95

Calls 6

_convert_pathMethod · 0.95
_short_float_fmtFunction · 0.85
valuesMethod · 0.80
elementMethod · 0.80
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected