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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file matplotlib-colors-1.0.8.tar.gz
.
File metadata
- Download URL: matplotlib-colors-1.0.8.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 089218224eb0b5ff361b1669aaa8c9638d39f1a8f8e9fada5c5dd588cbf05012 |
|
MD5 | 8c386266f082e3894858f2e2c29b3db6 |
|
BLAKE2b-256 | 239f9161b1e49caf93e7e441511b46f962caa3ba6b9011e6fbb5f87670544f17 |
File details
Details for the file matplotlib_colors-1.0.8-py3-none-any.whl
.
File metadata
- Download URL: matplotlib_colors-1.0.8-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a16c5cfbd1e62b2d45a4a2e60a2c78e5377b753fcc69bd6460fc3e91defe383 |
|
MD5 | 14259264093aa8dd70ad68d89b2ee094 |
|
BLAKE2b-256 | 3bb1eeacea39fa19dd14a73bdab5338e237e1e4eca3a921e097aa2aa1c24c15c |