Skip to main content

A collection of curated color profiles for matplotlib.

Project description

Matplotlib Colors

A collection of curated colors and colormaps for matplotlib.

Installation

pip install matplotlib-colors

Demo

All colors and colormaps

Examples

Colormaps

Call the register_cmaps function to add the new colormaps to matplotlib. Then the desired colormap can be specified by name as the cmap argument.

from matplotlib_colors import register_cmaps
register_cmaps()  # Adds new colormaps to matplotlib

# Build your data viz as normal with matplotlib
import numpy as np
import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = [x * x for x in x]
plt.scatter(x, y, c=range(12), cmap='analyst')  # Specify one of the new colormap names
plt.colorbar()
plt.show()

Alternatively, all new colormap objects can be accessed directly by importing the colormaps dict and specifying a colormap by name.

import numpy as np
import matplotlib.pyplot as plt
from matplotlib_colors import colormaps

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = [x * x for x in x]
plt.scatter(x, y, c=range(12), cmap=colormaps['analyst'])  # Specify a colormap from colormaps dict
plt.colorbar()
plt.show()

The full list of colormap names can be found by importing the colormap_names list.

from matplotlib_colors import colormap_names

Colors

The package includes a large selection of colors that can be accessed directly by importing colors and specifying a color name.

import matplotlib.pyplot as plt
from matplotlib_colors import colors

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
y = [x * x for x in x]
plt.scatter(x, y, c=colors['PL_RED'])  # All points colored with PL_RED
plt.colorbar()
plt.show()

The full list of color names can be found by importing the color_names list.

from matplotlib_colors import color_names

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

matplotlib-colors-1.0.15.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

matplotlib_colors-1.0.15-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file matplotlib-colors-1.0.15.tar.gz.

File metadata

  • Download URL: matplotlib-colors-1.0.15.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for matplotlib-colors-1.0.15.tar.gz
Algorithm Hash digest
SHA256 06e7f7f45b4c09551cb1776db1f6e3db2b8525246ccfcc4a027e5b98c102a906
MD5 54f19283af7e5413a7a8afc26a2429d7
BLAKE2b-256 539d9082b4d0744dbc0acb84b22b3d14be97b496cc4e164970b4bbc94b27013f

See more details on using hashes here.

File details

Details for the file matplotlib_colors-1.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for matplotlib_colors-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 521f41cd2976ecac0ba3e132dc36e5d9d47be71f727e72fddc59460bf333d2a2
MD5 31e8c2fb0c814fbd9663c6c53e0655bc
BLAKE2b-256 ee6d140994725577045e6519cf5e97c5f5613000cb0af492cc9c50104684784a

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