How to use the svgutils.transform.FigureElement function in svgutils

To help you get started, we’ve selected a few svgutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github btel / svg_utils / src / svgutils / compose.py View on Github external
"""

import os
import re

from svgutils import transform as _transform
CONFIG = {'svg.file_path': '.',
          'figure.save_path' : '.',
          'image.file_path': '.',
          'text.position': (0, 0),
          'text.size': 8,
          'text.weight': 'normal',
          'text.font': 'Verdana'}


class Element(_transform.FigureElement):
    """Base class for new SVG elements."""

    def scale(self, factor):
        """Scale SVG element.

        Parameters
        ----------
        factor : float
            The scaling factor.

            Factor > 1 scales up, factor < 1 scales down.
        """

        self.moveto(0, 0, factor)
        return self
github btel / svg_utils / src / svgutils / compose.py View on Github external
def find_id(self, element_id):
        """Find a single element with the given ID.

        Parameters
        ----------
        element_id : str
            ID of the element to find

        Returns
        -------
        found element
        """
        element = _transform.FigureElement.find_id(self, element_id)
        return Element(element.root)