Skip to main content

A library for generating Matplotlib markers from SVG files.

Project description

PyPI - Version PyPI - Status PyPI - License PyPI - Python Version PyPI - Format PyPI - Downloads pytest

SVG-pltmarker

A Python library for generating matplotlib markers from SVG files.

Install

pip install svg-pltmarker
pip install 'svg-pltmarker[dev]'  # for developers

Dependencies

Python version 3.10.0 or higher is required.

Libraries:

Usage

Sample notebook (Colaboratory)

import matplotlib.pyplot as plt
import numpy as np
from svg_pltmarker import get_marker_from_svg


# Generate Maplotlib marker from SVG file.
marker = get_marker_from_svg(url="https://upload.wikimedia.org/wikipedia/commons/8/84/Matplotlib_icon.svg")

# Scatter plot
fig, ax = plt.subplots(figsize=(10, 10))
ax.set_aspect("equal")
ax.set_axis_off()
x, y = np.meshgrid(np.linspace(0, 2, 11), np.linspace(0, 2, 11))
plt.scatter(x, y, marker=marker, s=2500, color="None", edgecolors="black")
plt.xlim(0, 2)
plt.ylim(0, 2)
plt.show()

Then get below figure:

Sample Figure

Reference

  1. https://developer.mozilla.org/ja/docs/Web/SVG/Element
  2. https://triple-underscore.github.io/SVG11/shapes.html
  3. https://github.com/nvictus/svgpath2mpl

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

svg_pltmarker-1.0.0.tar.gz (11.3 kB view hashes)

Uploaded Source

Built Distribution

svg_pltmarker-1.0.0-py3-none-any.whl (15.4 kB view hashes)

Uploaded Python 3

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