cmap
Scientific colormaps for python, without dependencies
What it is and what it does
cmap is a lightweight Python library that bundles scientific colormaps from multiple sources—matplotlib, cmocean, colorbrewer, crameri, seaborn, and others—and makes them available without requiring matplotlib as a dependency. It provides two main objects: Color (a simple RGBA wrapper with conversion methods) and Colormap (a callable that maps scalar or array values to RGBA colors). The Colormap API mimics matplotlib's behavior, making it familiar to users already working with matplotlib, but cmap can be used standalone in any visualization context.
The library is designed for projects that need colormap functionality but want to avoid the overhead of installing matplotlib. It includes convenience methods to export colormaps to third-party formats compatible with napari, vispy, pygfx, plotly, bokeh, altair, earthengine-api, and pyqtgraph, making it a bridge between different visualization ecosystems. It requires only numpy at runtime and supports Python 3.9 and later.
Use it for:
- Use it in a data visualization library that needs colormap support without forcing users to install matplotlib.
- Use it to map scientific data (images, arrays) to colors in napari, vispy, or other visualization frameworks.
- Use it to access perceptually uniform colormaps from cmocean or crameri in a lightweight, numpy-only context.
- Use it to build custom colormaps from color sequences and export them to multiple third-party visualization tools.
- Use it in headless or server-side applications where matplotlib's full feature set is unnecessary.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
cmap provides a collection of scientific colormaps (from matplotlib, cmocean, colorbrewer, crameri, seaborn, and others) that work with only numpy as a dependency, without requiring matplotlib.
Yes. cmap is actively maintained, has no security vulnerabilities, a permissive license, and solves a real problem—providing scientific colormaps without matplotlib's overhead. It is well-suited for projects that need colormap functionality but want minimal dependencies. Install it if you work with visualization libraries that support cmap exports or if you need colormaps in a lightweight, numpy-only environment.
Install
cmap on PyPI
pip
pip install cmapuv
uv add cmappoetry
poetry add cmapInstalling cmap
Before you install
Installation is straightforward with low friction—a pure Python wheel with only numpy as a runtime dependency. The project is actively maintained with recent commits and a stable release history since late 2022.
License in practice
BSD-3-Clause is a permissive open-source license; you can use, modify, and distribute cmap freely in commercial and private projects provided you include the license notice.
Quickstart
pip install cmap
import cmap
import numpy as np
cmap1 = cmap.Colormap(["red", "green", "blue"])
colors = cmap1(np.linspace(0, 1, 5))
Input arrays passed to a Colormap must be normalized to the range 0–1; raw integer or unbounded data must be rescaled before mapping.
Verify before relying
- Whether the package's type annotations and test coverage meet the stated 'strictly typed and fully tested' claim.
- Performance characteristics when mapping large numpy arrays to colors.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 171 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 161,434/month — #10,634 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cmap-0.7.2-py3-none-any.whl
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
cmcrameriProvides perceptually uniform colormaps by…
permissive · top 15,000 on PyPI
cmweathercmweather provides a collection of colormaps…
permissive · top 15,000 on PyPI
colourmapGenerates unique RGB and HEX colors from input…
permissive · top 15,000 on PyPI
colorcetColorcet provides a collection of perceptually…
unclear · top 5,000 on PyPI
cmoceanProvides perceptually uniform colormaps…
unclear · top 15,000 on PyPI
brewer2mplProvides access to all 165 ColorBrewer2.org…
permissive · top 15,000 on PyPI
palettablePalettable provides a library of color palettes…
permissive · top 5,000 on PyPI
distinctipyGenerates lists of visually distinct colors of…
permissive · top 15,000 on PyPI
basemapBasemap renders geographic data on matplotlib…
permissive · top 15,000 on PyPI