Overview of colorcet
mainbokeh, matplotlib, holoviews, and datashader. These colormaps are based on the perceptually uniform set created by Peter Kovesi at the Center for Exploration Targeting.repository·main·Indexed 20 days ago
https://github.com/holoviz/colorcetA collection of over 100 perceptually uniform continuous and categorical colormaps for Python-based data visualization. Designed for use with plotting libraries such as bokeh, matplotlib, holoviews, and datashader, these colormaps are based on the perceptually uniform set created by Peter Kovesi at the Center for Exploration Targeting. Includes utilities for visualizing colormaps via swatches, sine ramps, and scatter plots.
bokeh, matplotlib, holoviews, and datashader. These colormaps are based on the perceptually uniform set created by Peter Kovesi at the Center for Exploration Targeting.Pixi manages development workflows through tasks (run via pixi run <task-name>) and environments (sets of packages).
pixi task listpixi shell (similar to conda activate)pixi run sync-git-tagsdefault environment to edit documentation or debug notebooks:pixi run labYou can target specific environments using the -e flag. For example, to run a task in the test-core environment:
pixi run -e test-core <task-name>To contribute to colorcet, use pixi to manage environments and tasks. The setup process creates a default environment, installs colorcet in editable mode, and installs pre-commit for linting.
git clone https://github.com/<Your Username Here>/colorcetpixi run setup-devNOTE The first run creates a
pixi.lockfile and a.pixidirectory. Avoid placing the source directory in a cloud-synced folder (like Dropbox or OneDrive) as the.pixidirectory can become very large.
pixi run setup-devTo build the documentation website locally:
pixi run docs-buildTo build packages for distribution:
pixi run build-pippixi run build-condaColorcet supports Python 3.10 and greater on Linux, Windows, and Mac. You can install it using conda or pip.
# Using conda
conda install colorcet
# Using pip
python -m pip install colorcetTo test the latest features before they are officially released, you can install the development version from the pyviz channel using conda.
conda install -c pyviz/label/dev colorcetMaintain code quality using the following built-in tasks:
colorcet uses pre-commit to lint and format code. It is installed automatically via setup-dev.
pixi run lintpre-commit installpre-commit run --all-filesStatic type checking is performed using mypy:
pixi run test-typecolorcet/tests/) using pytest:pixi run test-unitNote: You can run these in specific Python version environments (e.g., test-39, test-312) using pixi run -e test-312 test-unit.doc/ folder using nbval to ensure they run without error:pixi run test-exampleTo use the pixi development environment within VS Code:
Ctrl+Shift+P or Cmd+Shift+P).Python: Select Interpreter.{'default': Pixi} from the list.This ensures VS Code uses the correct dependencies and Python version managed by Pixi.
Colorcet is a collection of perceptually accurate 256-color colormaps designed for use with Python plotting libraries such as Bokeh, Matplotlib, HoloViews, and Datashader.
It provides two primary types of colormaps:
fire (a perceptually uniform version of Matplotlib's hot) and rainbow4 (a version of jet).Colorcet uses a structured naming convention for Glasbey colormaps to allow users to specify constraints on the color space. This is useful when you need to ensure colors are visible against specific backgrounds or fall within certain hue ranges.
Naming Pattern:
glasbey_<starting_palette>[_<min|max>c_<chroma_value>][_<min|max>l_<lightness_value>][_hue_<start>_<end>]
Components:
starting_palette: The initial set of colors used to seed the algorithm (e.g., bw for black/white).minc_<value> / maxc_<value>: Constraints on chroma (saturation).minl_<value> / maxl_<value>: Constraints on lightness.hue_<start>_<end>: Constraints on the hue range (e.g., hue_150_280 for cool colors).Common Aliases:
glasbey_bw: The full CIELAB gamut (includes dark/light/gray colors).glasbey: An alias for glasbey_bw_minc_20 (removes grays/low chromaticity).glasbey_dark: Colors with lightness $\le$ 70 (optimized for dark backgrounds).glasbey_light: Colors with lightness $\ge$ 30 (optimized for light backgrounds).glasbey_warm: Colors with hues between 330° and 100°.glasbey_cool: Colors with hues between 150° and 280°.Each colormap in colorcet follows a specific naming pattern that describes its properties:
{category}_{huesequence}_{lightnessrange}_c{meanchroma}[_s{colorshift}[_r]]
This structure allows you to identify the category, hue sequence, lightness range, mean chroma, and optional color shifts or refinements directly from the name.
When choosing a colormap in Colorcet, consider the nature of your data: