Skip to main content

mpl_colors

A python 3.6+ library extending matplotlib's color handling.

Named color enums

Makes matplotlib's named colors more discoverable.

Defines enums for each of matplotlib's sets of named colours (base, Tableau, xkcd and CSS4), and one which combines all of them (where Tableau and xkcd names are prepended with TAB_ and XKCD_ respectively, like matplotlib). Color names are in SCREAMING_SNAKE_CASE, as recommended. Names originally containing a slash (/) replace it with the _SLASH_ (necessary to prevent collisions).

Instances of these enums are also instances of a named tuple with members r, g, and b (all floats between 0 and 1). They also support a number of methods for conversion into colour.Color objects, and RGBA, HSL, HSV, and YIQ tuples. Also, length-6 hex strings (prepended with #) and colour's "web" format (whichever is shortest of W3C named color, length-3 hex, or length-6 hex, preferring named as a tie-break).

The enums are automatically generated directly from matplotlib.colors using the included make_colors.py. Like matplotlib, they support both spellings of the word "grey"/"gray".

LabelColormap

matplotlib.colors.Colormap subclass which deterministically converts integers into a random RGB tuple.

from matplotlib import pyplot as plt
import numpy as np

from mpl_colors import LabelColorMap

img = np.random.randint(0, 255, (20, 20), dtype=np.uint8)
masked = np.ma.masked_where(img < 100, img)

fig, ax = plt.subplots()
ax.imshow(masked, cmap=LabelColorMap(), interpolation='nearest')
fig.show()

Metadata

Release files for mpl-colors 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mpl-colors 0.2.0
File Size Uploaded Provenance
mpl_colors-0.2.0.tar.gz 31.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mpl-colors 0.2.0
File Interpreter ABI Platform
mpl_colors-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 63.5 kB

Release files / mpl_colors-0.2.0.tar.gz

Download URL mpl_colors-0.2.0.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
82ce381253f2b4d0aaf1dbb0d47a22aa61bbcae831df36059798f0d6ccf08cb9
BLAKE2b-256 checksum
How to use checksums
5b866ac88db35bf2f54576fc9564eaa6d1ce6d1f3f49a3f7069ef9e2beb2b2a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / mpl_colors-0.2.0-py3-none-any.whl

Download URL mpl_colors-0.2.0-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae037c0b4261dd109ce99ce1e64e129f38486699bc8d54a56ef2617c943ac6d3
BLAKE2b-256 checksum
How to use checksums
bd95790eea0ac0aa20f5a358246bec7cd78187a9eaee2725f7333ad4061994f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Security for mpl-colors 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page