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