Collection of colormaps or color palettes for Python
Project description
Colormaps
Colormaps is a library of collection of colormaps or color palettes for Python. It's written in Python with matplotlib and numpy as dependencies. You can use Colormaps to customize matplotlib plots.
Colormaps has colormaps or color palettes from:
- cartocolors
- cmocean
- colorbrewer
- cubehelix
- ncar ncl
- scientific
- tableau
- carbonplan
- cmasher
may be more
Docs: https://pratiman-91.github.io/colormaps/
Getting started
Dependencies
Python with:
- matplotlib
- numpy
Installation
pip install colormaps
or you can also use GitHub repo
git clone https://github.com/pratiman-91/colormaps.git
cd colormaps
python setup.py install
Finding Colormaps
Colormaps are pre-built and loaded at the time of importing.
Using Colormaps
- Importing Colormaps
import colormaps as cmaps
cmaps.drought_severity
cmaps.ice
- Getting discrete number of levels
cmaps.ice.discrete(10)
- Shifting the colormap
cmaps.ice.shift(0.5)
- Shifting and then discrete levels
cmaps.ice.shift(0.5).discrete(10)
- Discrete levels then cut the colormap from left side
cmaps.ice.discrete(11).cut(0.25, 'left')
- Concatenate two or more colormaps
from colormaps.utils import concat
concat1 = concat(["ice", "BkBlAqGrYeOrReViWh200"])
- Concatenate two or more colormaps based on ratio
from colormaps.utils import concat
concat2 = concat([cmaps.ice, cmaps.BkBlAqGrYeOrReViWh200], ratios=[0.25,0.75])
- Matplotlib usage example
import matplotlib.pyplot as plt
import colormaps as cmaps
import numpy as np
x = y = np.arange(-3.0, 3.01, 0.05)
X, Y = np.meshgrid(x, y)
sigmax = sigmay = 1.0
mux = muy = sigmaxy=0.0
Xmu = X-mux
Ymu = Y-muy
rho = sigmaxy/(sigmax*sigmay)
z = Xmu**2/sigmax**2 + Ymu**2/sigmay**2 - 2*rho*Xmu*Ymu/(sigmax*sigmay)
denom = 2*np.pi*sigmax*sigmay*np.sqrt(1-rho**2)
Z = np.exp(-z/(2*(1-rho**2))) / denom
plt.pcolormesh(X,Y,Z,cmap=cmaps.cubehelix3_16_r)
plt.colorbar()
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
colormaps-0.4.0.tar.gz
(467.2 kB
view hashes)
Built Distribution
colormaps-0.4.0-py3-none-any.whl
(696.7 kB
view hashes)
Close
Hashes for colormaps-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37403743117339364f610503a477969dce80dbc7dff3618b6910a9f776958662 |
|
MD5 | e3cef0e2370054e7cbe71ffb6718e52d |
|
BLAKE2b-256 | a542e88bb704a91c9e9562b2c6d299df151986dc4626a1910b3cda35d1a2f526 |