{"id":3432,"library":"colorcet","title":"Colorcet","description":"Colorcet is a collection of perceptually uniform and distinct colormaps for use with Python plotting programs like Matplotlib, Bokeh, HoloViews, and Datashader. It provides 256-color continuous colormaps based on Peter Kovesi's work and perceptually distinct categorical colormaps. The library is actively maintained, with the current version being 3.1.0, and receives updates for new colormaps and compatibility with the Python ecosystem.","status":"active","version":"3.1.0","language":"en","source_language":"en","source_url":"https://github.com/holoviz/colorcet","tags":["colormaps","visualization","matplotlib","bokeh","holoviews","datashader","perceptually-uniform"],"install":[{"cmd":"pip install colorcet","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Colorcet officially supports Python 3.7 and greater.","package":"python","optional":false},{"reason":"Required for using Colorcet colormaps directly with Matplotlib's API (e.g., `plt.imshow(cmap=cc.cm.colormap_name)`).","package":"matplotlib","optional":true},{"reason":"Required for using the `colorcet.plotting.swatch` and `swatches` functions to visualize colormaps.","package":"holoviews","optional":true}],"imports":[{"note":"The common and recommended alias for Colorcet.","symbol":"colorcet","correct":"import colorcet as cc"},{"note":"For Matplotlib `cmap` arguments, access colormaps via `cc.cm.<name>`. `cc.<name>` directly provides the Bokeh-style hex list palette. Matplotlib also registers colormaps under names like `cet_<name>` (e.g., `plt.get_cmap('cet_fire')`).","wrong":"cc.fire (for Matplotlib directly)","symbol":"continuous_colormap","correct":"cc.cm.fire"},{"note":"Access hex-string palettes directly as `cc.<name>` or `cc.palette.<name>`. For Matplotlib, these might need to be wrapped in `matplotlib.colors.ListedColormap` for some plotting functions.","wrong":"cc.cm.glasbey (for Bokeh-style hex list)","symbol":"categorical_palette","correct":"cc.glasbey"}],"quickstart":{"code":"import numpy as np\nimport matplotlib.pyplot as plt\nimport colorcet as cc\n\n# Create some dummy data\nxs, _ = np.meshgrid(np.linspace(0, 1, 80), np.linspace(0, 1, 10))\n\n# Use a continuous colormap from colorcet with Matplotlib\nplt.figure(figsize=(8, 1))\nplt.imshow(xs, cmap=cc.cm.fire, aspect='auto')\nplt.title('Using colorcet.cm.fire')\nplt.axis('off')\nplt.show()\n\n# Example of a categorical palette (prints hex codes)\nprint(f\"First 5 colors of glasbey palette: {cc.glasbey[:5]}\")","lang":"python","description":"This quickstart demonstrates how to import `colorcet` and apply one of its continuous colormaps to a Matplotlib plot. It also shows how to access a categorical palette as a list of hex strings."},"warnings":[{"fix":"Refer to the official documentation and GitHub examples for usage demonstrations and plotting commands, rather than the removed CLI.","message":"The `colorcet examples` command-line interface (CLI) was removed in version 3.1.0.","severity":"breaking","affected_versions":">=3.1.0"},{"fix":"Upgrade your Python environment to 3.7 or newer. Python 3.7+ is supported, with 3.9+ being recommended by some sources.","message":"Support for Python 2.7 and 3.6 was officially dropped in version 3.1.0. Older Python versions are no longer tested or maintained.","severity":"breaking","affected_versions":">=3.1.0"},{"fix":"If migrating from pre-1.0.0 code using `inferno`, update calls to `bmy`. For new code, use `bmy` directly.","message":"The `inferno` colormap was renamed to `bmy` in version 1.0.0 to avoid confusion with Matplotlib's built-in `inferno`.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Consult the User Guide for detailed explanations on accessing continuous and categorical colormaps in different formats for various plotting backends.","message":"Colorcet colormaps can be accessed in several ways: `cc.cm.<name>` (Matplotlib colormap object), `cc.palette.<name>` or `cc.<name>` (Bokeh-style hex string list), or via Matplotlib's registry using names like `cet_<name>` (e.g., `plt.get_cmap('cet_fire')`). Choosing the correct access method depends on the plotting library and desired output format.","severity":"gotcha","affected_versions":"All"},{"fix":"For scientific visualization, understand the characteristics of the chosen colormap (continuous vs. categorical, colorblind safety) and verify its suitability for your data and audience.","message":"While Colorcet's continuous colormaps are perceptually uniform, its categorical colormaps are perceptually *distinct* but not necessarily uniform. Also, not all colormaps are guaranteed to be colorblind-safe or perceptually uniform in their monochrome representation, unlike some Matplotlib-native colormaps.","severity":"gotcha","affected_versions":"All"},{"fix":"Install `holoviews` (`pip install holoviews`) and ensure the correct `hv.extension()` is called before using `colorcet.plotting` functions.","message":"The functions in `colorcet.plotting` (e.g., `swatch`, `swatches`) require `holoviews` to be installed and the appropriate `holoviews` extension loaded (e.g., `hv.extension('matplotlib')` or `hv.extension('bokeh')`).","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}