Skip to main content

SVG path parser for matplotlib

Project description

https://travis-ci.org/nvictus/svgpath2mpl.svg?branch=master

Parse 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.

http://i.imgur.com/NcZVznQ.png

Based 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.

>>> 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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svgpath2mpl-0.2.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

svgpath2mpl-0.2.1-py2.py3-none-any.whl (7.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file svgpath2mpl-0.2.1.tar.gz.

File metadata

  • Download URL: svgpath2mpl-0.2.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for svgpath2mpl-0.2.1.tar.gz
Algorithm Hash digest
SHA256 22be2979bfdd68e9ab1877d8fd7e6e5ad4c3650b78845af085fee56632501a54
MD5 410d7e05df8ca18e838db64b289536b8
BLAKE2b-256 cecb7e8b48a9dbc3d9b1bdff2a12706102be07c472720642efe736d62a4bd3a8

See more details on using hashes here.

File details

Details for the file svgpath2mpl-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: svgpath2mpl-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for svgpath2mpl-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5d35e07ade59159f29cf6d047e893ed11bc659e65e62a2f409ad7b1daff1394e
MD5 217cc5c14dd9d0dad58ee1fecefe21d3
BLAKE2b-256 b9ae2a2458fa387771498498222d65d679ab2076f0838e5a9e0d9a2966bd4f0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page