Skip to main content

No project description provided

Project description

mpl-flags

National flags for Matplotlib.

Flags data

mpl-flags contains the flag data in vector format readily usable with Matplotlib. The original flags data are in svg format, and are converted to matplotlib's Path data using mpl-simple-svg-parser. mpl-flags does not contain the original svg files, only the converted data in numpy format (vertices and codes).

The flag data is collected from various sources. Currently, it includes flags from

  1. Google's noto color emoji font : https://github.com/googlefonts/noto-emoji
  2. circle-flags : https://github.com/HatScripts/circle-flags
  3. flag-icons : https://github.com/lipis/flag-icons

Different sources can render the flags differently.

Usage

from mpl_flags import Flags

flags = Flags("noto_waved") # You initialize the Flags class specifying what kind of
                            # flags you like to use.
                            # `noto_waved` is flags from google's noto emoji fonts.

fig, ax = plt.subplots(figsize=(3, 3))
flags.show_flag(ax, "KR")
from matplotlib.offsetbox import AnnotationBbox

flags = Flags("noto_original")

fig, ax = plt.subplots(figsize=(3, 3))
da = flags.get_drawing_area("KR", wmax=100)
ab = AnnotationBbox(da, (0.5, 0.5), frameon=True,
                    box_alignment=(0.5, 0.5))
ax.add_artist(ab)

Installation

You can install using pip:

pip install mpl_flags

Development Installation

pip install -e ".[dev]"

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mpl_flags-0.1.0-py3-none-any.whl (15.2 MB view details)

Uploaded Python 3

File details

Details for the file mpl_flags-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mpl_flags-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for mpl_flags-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e25a2df1d2da1131a235dfefec87512e763843e65bae1923c2a568a8346cc0b1
MD5 e8378ccb130205d01c5300fae833bf5b
BLAKE2b-256 3cb453f60fac7a296a269543ace9be30c05504e1c3b5f9f38c484355563904ac

See more details on using hashes here.

Provenance

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