Skip to main content

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:

Docs: https://pratiman-91.github.io/colormaps/

Getting started

Dependencies

Python with:

  • matplotlib
  • numpy

Installation

pip install colormaps

or using conda

conda install colormaps -c conda-forge`

or using mamba

mamba install colormaps

or you can also use GitHub repo

git clone https://github.com/pratiman-91/colormaps.git
cd colormaps
python setup.py install

Using Colormaps

  • Importing Colormaps
import colormaps as cmaps
cmaps.drought_severity

brwnyl

cmaps.ice

ice

  • Getting discrete number of levels
cmaps.ice.discrete(10)

ice_discrete

  • Shifting the colormap
cmaps.ice.shift(0.5)

ice_shift

  • Shifting and then discrete levels
cmaps.ice.shift(0.5).discrete(10)

ice_shift_discrete

  • Discrete levels then cut the colormap from left side
cmaps.ice.discrete(11).cut(0.25, 'left')

ice_shift_discrete

  • Concatenate two or more colormaps
from colormaps.utils import concat
concat1 = concat(["ice", "BkBlAqGrYeOrReViWh200"])

concat_1

  • Concatenate two or more colormaps based on ratio
from colormaps.utils import concat
concat2 = concat([cmaps.ice, cmaps.BkBlAqGrYeOrReViWh200], ratios=[0.25,0.75])

concat_1

  • 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()

concat_1

Finding Colormaps

Colormaps are pre-built and loaded at the time of importing.

  • Show different collections
from colormaps.utils import show_cmaps_collection
show_cmaps_collection(collection='cmasher')

show_cmaps_collection

  • Show all collections
from colormaps.utils import show_cmaps_all
show_cmaps_all()

This is just a sample! You will get a long list of all possible colormap collections.

show_cmaps_all

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.2.tar.gz (492.3 kB view details)

Uploaded Source

Built Distribution

colormaps-0.4.2-py3-none-any.whl (727.9 kB view details)

Uploaded Python 3

File details

Details for the file colormaps-0.4.2.tar.gz.

File metadata

  • Download URL: colormaps-0.4.2.tar.gz
  • Upload date:
  • Size: 492.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for colormaps-0.4.2.tar.gz
Algorithm Hash digest
SHA256 c703d62a4fededfcfed57bef6aa772422b535896645cbf8c58690e4bbe16005c
MD5 06d425376aa8a07bc516d5e44d4d8913
BLAKE2b-256 452137682c96e0649446a5cd2bcdf3cfcb18b025d48b75e565bd191ea1f4bab6

See more details on using hashes here.

File details

Details for the file colormaps-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: colormaps-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 727.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for colormaps-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43ed7216b3da5e0602fe806bb7fbe7ca2cfaf44c4a8d70a669b8f2327ddedc24
MD5 eb6f7ceadefbe2be47064515346c914a
BLAKE2b-256 179b623fb043327d00e155a41d8a4a2e5510f2e3f7897d3eeb9a8908494c7d45

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