Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nvictus/svgpath2mpl
SVG path parser for matplotlib
https://github.com/nvictus/svgpath2mpl
matplotlib parser python svg svg-path
Last synced: 5 days ago
JSON representation
SVG path parser for matplotlib
- Host: GitHub
- URL: https://github.com/nvictus/svgpath2mpl
- Owner: nvictus
- License: bsd-3-clause
- Created: 2016-04-10T06:47:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-17T19:53:32.000Z (over 2 years ago)
- Last Synced: 2024-10-03T12:17:38.819Z (about 1 month ago)
- Topics: matplotlib, parser, python, svg, svg-path
- Language: Python
- Homepage:
- Size: 1.46 MB
- Stars: 60
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE
Awesome Lists containing this project
README
svgpath2mpl
===========.. image:: https://github.com/nvictus/svgpath2mpl/actions/workflows/python-test.yml/badge.svg
:target: https://github.com/nvictus/svgpath2mpl/actions
:alt: Github Actions CI.. image:: https://badge.fury.io/py/svgpath2mpl.svg
:target: https://badge.fury.io/py/svgpath2mpl
:alt: PyPI versionParse SVG paths into matplotlib ``Path`` objects for plotting.
A path in SVG is defined by a 'path' element which contains a ``d="(path data)"`` attribute that contains moveto, line, curve (both cubic and quadratic Béziers), arc and closepath instructions. Matplotlib actually supports all of these instructions natively but doesn't provide a parser or fully compatible API.
.. image:: http://i.imgur.com/NcZVznQ.png
:align: center
:width: 150pxBased on:
1. `svg_parse `_ for matplotlib by Nicolas P. Rougier (BSD license).
2. `svg.path `_ by Lennart Regebro (MIT license).
This module adds the path commands missing from (1), including smooth curves and endpoint-parameterized elliptical arcs.
.. code-block:: python
>>> from svgpath2mpl import parse_path
>>> parse_path('M 100 100 L 300 100')
Path(array([[ 100., 100.], [ 300., 100.]]), array([1, 2], dtype=uint8))See the Jupyter Notebook `gallery `_ of examples.
Resources
---------
See the `SVG Specification `_.See the matplotlib path `tutorial `_ and `API docs `_.
License
-------BSD (3-Clause).