svg

Create string versions of SVG elements.

svgis.svg.circle(point, precision=None, **kwargs)

Create a svg circle element. Keyword arguments are mapped to attributes.

Parameters:
  • point (tuple) – The center of the circle
  • precision (int) – rounding precision
Returns:

str

svgis.svg.defstyle(style=None)

Create a defs element that wraps a CSS style.

Parameters:style (string) – A CSS string.
Returns:str
svgis.svg.drawing(size, members, precision=None, viewbox=None, style=None)

Create an SVG element.

Parameters:
  • size (tuple) – width, height
  • members (list) – Strings to add to output.
  • viewbox (Sequence) – Four coordinates that describe an SVG viewBox.
  • style (string) – CSS string.
Returns:

str

svgis.svg.group(members=None, **kwargs)

Create a group with the given scale and translation.

Parameters:
  • members (Sequence) – unicode SVG elements
  • kwargs (dict) – elements of this dictionary will be converted to attributes of the group, i.e. key=”value”.
Returns:

str

svgis.svg.line(start, end, precision=None, **kwargs)

Create an svg line element.

Parameters:
  • start (tuple) – starting coordinate
  • end (tuple) – ending coordinate
  • precision (int) – rounding precision
Returns:

str

svgis.svg.path(coordinates, precision=None, **kwargs)

Create an svg path element as a string.

Parameters:
  • coordinates (Sequence) – A sequence of coordinates and string instructions
  • precision (int) – rounding precision
Returns:

str

svgis.svg.rect(start, width, height, precision=None, **kwargs)

Create an svg rect element.

Parameters:
  • start (tuple) – starting coordinate
  • width (int) – rect width
  • height (int) – rect height
  • precision (int) – rounding precision
Returns:

str

svgis.svg.text(string, start, precision=None, **kwargs)

Create an svg text element.

Parameters:
  • string (str) – text for element
  • start (tuple) – starting coordinate
Returns:

str

svgis.svg.toattribs(**kwargs)

Convert keyword arguments to SVG attribute definitions.

Returns:str