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

Method __init__

lib/matplotlib/backends/backend_svg.py:303–341  ·  view source on GitHub ↗
(self, width, height, svgwriter, basename=None, image_dpi=72,
                 *, metadata=None)

Source from the content-addressed store, hash-verified

301
302class RendererSVG(RendererBase):
303 def __init__(self, width, height, svgwriter, basename=None, image_dpi=72,
304 *, metadata=None):
305 self.width = width
306 self.height = height
307 self.writer = _XMLWriter(svgwriter)
308 self.image_dpi = image_dpi # actual dpi at which we rasterize stuff
309
310 if basename is None:
311 basename = getattr(svgwriter, "name", "")
312 if not isinstance(basename, str):
313 basename = ""
314 self.basename = basename
315
316 self._groupd = {}
317 self._image_counter = itertools.count()
318 self._clip_path_ids = {}
319 self._clipd = {}
320 self._markers = {}
321 self._path_collection_id = 0
322 self._hatchd = {}
323 self._has_gouraud = False
324 self._n_gradients = 0
325
326 super().__init__()
327 self._glyph_map = dict()
328 str_height = _short_float_fmt(height)
329 str_width = _short_float_fmt(width)
330 svgwriter.write(svgProlog)
331 self._start_id = self.writer.start(
332 'svg',
333 width=f'{str_width}pt',
334 height=f'{str_height}pt',
335 viewBox=f'0 0 {str_width} {str_height}',
336 xmlns="http://www.w3.org/2000/svg",
337 version="1.1",
338 id=mpl.rcParams['svg.id'],
339 attrib={'xmlns:xlink': "http://www.w3.org/1999/xlink"})
340 self._write_metadata(metadata)
341 self._write_default_style()
342
343 def _get_clippath_id(self, clippath):
344 """

Callers

nothing calls this directly

Calls 8

_write_metadataMethod · 0.95
_write_default_styleMethod · 0.95
_XMLWriterClass · 0.85
_short_float_fmtFunction · 0.85
countMethod · 0.80
__init__Method · 0.45
writeMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected