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

py -m pip install matplotlib-colors

Examples

Colormaps

All new color maps can be added to matplotlib simply by calling the register_cmaps function. The desired colormap can be specified by name with the cmap argument.

from matplotlib_colors import register_cmaps

register_cmaps()  # Adds new colourmaps 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]
c = np.linspace(0, 100, 12)  # Where each point lands on the colour scale
plt.scatter(x, y, c=c, cmap='analyst')  # Specify a new color name from matplotlib_colors
plt.colorbar()
plt.show()

Alternatively, new colormap objects can be accessed directly by importing colormaps 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]
c = np.linspace(0, 100, 12)  # Where each point lands on the colour scale
plt.scatter(x, y, c=c, cmap=colormaps['analyst'])  # Specify a new color name from matplotlib_colors
plt.colorbar()
plt.show()

The full list of colormaps can be found by color_names list.

from matplotlib_colors import colormap_names
print(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'])
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
print(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.13.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

matplotlib_colors-1.0.13-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: matplotlib-colors-1.0.13.tar.gz
  • Upload date:
  • Size: 3.9 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.13.tar.gz
Algorithm Hash digest
SHA256 2500449d45b49436b40d0ae2e9d943cfa4f2adc3b536f899a1140c711fefc96c
MD5 1410ac3c1cb630f7e5279a22a9df41f2
BLAKE2b-256 6d46fabc7b140c2b7a8b5d5b5eaf0e0d9547b9d40d1c8ad658c09e89dbc9708d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for matplotlib_colors-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 1b695105dd40efb12aa2b3db9cfa3414da767782b1d1e185edad02ba93657ab1
MD5 c76de197aa0f639d6e08b64d8c1e3690
BLAKE2b-256 60d08eb64c7cd9f626fdfa89f4dd02f8ec24366922051952ed7eddc6d5eeef1d

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