roque-cmap is a Python package that provides custom color maps for use in data visualization. It includes functions to generate evenly spaced arrays of colors and to create matplotlib colormaps from these custom colors.
The package includes two palettes: roque and roque_chill. Both colormaps are inspired by the classic viridis palette, and are perceptually uniform, meaning they are particularly suited to representing numeric values. The roque_chill colormap is a modified version of the roque with some of the darkest and brightest colors removed for a more subdued look.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Recommended: Python 3.11 or higher (may also work with lower versions)
matplotlibfor using the built-in colormap
If you prefer using uv for environment and dependency management, you can install roque-cmap straight from GitHub (the project is not on PyPI):
# add the package to an existing uv-managed project
uv add git+https://github.com/astrojarred/roque-cmap.gitOr spin up a fresh virtual environment and install directly from the repo URL:
uv init
uv add git+https://github.com/astrojarred/roque-cmap.git# install locally after cloning
git clone https://github.com/astrojarred/roque-cmap
pip install ./roque-cmapAdd the following line to your pyproject.toml file:
[tool.poetry.dependencies]
roque-cmap = { git = "https://github.com/astrojarred/roque-cmap.git" }Then run:
poetry install-
Clone the repository:
git clone https://github.com/astrojarred/roque-cmap cd roque-cmap -
Install the development dependencies:
uv sync --group dev
-
Install the package in editable mode:
uv pip install -e .
Add notes about how to use the system.
Here is an example of how to use the roque and roque_chill functions:
import matplotlib.pyplot as plt
import seaborn as sns
from roque_cmap import roque, roque_chill
import numpy as np
# Example 1
# Create a heatmap with the custom colormap in seaborn
data = np.random.rand(10, 12)
sns.heatmap(data, cmap=roque(10)) # sample 10 colors from the colormap
plt.title("Seaborn Heatmap with Roque colormap")
plt.show()
# Example 2
# Show off all colors
size = 255
data = np.zeros((size, size))
for i in range(size):
for j in range(size):
data[i, j] = (i + j) / (2 * size - 2)
sns.heatmap(data, cmap=roque())
# hide the ticks and labels
plt.xticks([])
plt.yticks([])
plt.title("Roque colormap")
plt.show()
# Example 3
# Create a matplotlib plot with the custom colormap
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.scatter(x, y, c=y, cmap=roque())
plt.colorbar()
plt.title("Matplotlib with Roque colormap")
plt.show()
# Example 4
# Compare roque and chill-roque side by side
size = 200
data = np.zeros((size, size))
for i in range(size):
for j in range(size):
data[i, j] = (i + j) / (2 * size - 2)
fig, axs = plt.subplots(1, 2, figsize=(10, 5))
for a, m in enumerate([roque, roque_chill]):
sns.heatmap(data, cmap=m(), ax=axs[a])
axs[a].set_title(f"{m().name} colormap")
axs[a].set_xticks([])
axs[a].set_yticks([])
plt.tight_layout()
plt.show()The project uses pytest for testing. To run the test suite:
uv run pytestTo run tests with verbose output:
uv run pytest -vTo check test coverage:
uv run pytest --cov=roque_cmap --cov-report=term-missingThis will show which lines of code are covered by tests and which are missing.
-
Clone the repository or your fork:
git clone https://github.com/astrojarred/roque-cmap.git cd roque-cmap -
Install the development dependencies:
uv sync --group dev
-
Install the package in editable mode:
uv pip install -e . -
Run the tests to ensure everything is set up correctly:
uv run pytest



