1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
.. _named_colormaps:
Named Colormaps
===============
Named colormaps supported by :class:`~pyvista.LookupTable`, :class:`~pyvista.Plotter`,
and other plotting-related methods.
The colormaps on this page are from multiple packages:
- :bdg-secondary:`mpl` -
`matplotlib colormaps <https://matplotlib.org/stable/gallery/color/colormap_reference.html>`_.
- :bdg-success:`cc` -
``colorcet`` `continuous <https://colorcet.holoviz.org/user_guide/Continuous.html#named-colormaps>`_
and `categorical <https://colorcet.holoviz.org/user_guide/Categorical.html#categorical>`_
colormaps.
- :bdg-primary:`cmo` - `cmocean colormaps <https://matplotlib.org/cmocean/>`_.
- :bdg-danger:`cmc` - `cmcrameri colormaps <https://github.com/callumrollo/cmcrameri?tab=readme-ov-file#cmcrameri>`_.
The type of the colormap is indicated as:
- :bdg-muted:`LSC` if it is a :class:`~matplotlib.colors.LinearSegmentedColormap`
- :bdg-muted:`LC` if it is a :class:`~matplotlib.colors.ListedColormap`
Each colormap is also tagged as:
- :material-regular:`visibility;2em;sd-text-info` - if it is perceptually uniform
- :material-regular:`visibility_off;2em;sd-text-warning` - if it is not perceptually uniform
A colormap is considered *perceptually uniform* if its color gradients are
evenly spaced, meaning equal steps in data produce equal perceptual changes.
Some colormap libraries assess perceptual uniformity using only the lightness
component (:math:`L^*` in the Lab color space), while others also consider
chromatic components (:math:`a^*` and :math:`b^*`). For the colormaps on this
reference page, both lightness *and* color differences must meet the uniformity
criteria to earn the :material-regular:`visibility;2em;sd-text-info` label.
Specifically, a colormap is labeled as perceptually uniform if:
#. The cumulative change in lightness (:math:`L^*` from CAM02-UCS) progresses
linearly. See `lightness of matplotlib colormaps <https://matplotlib.org/stable/users/explain/colors/colormaps.html#lightness-of-matplotlib-colormaps>`_.
#. The cumulative color difference (:math:`\Delta E`, using the CIEDE2000
metric) progresses linearly. See `Fig. 3c: cumulative color lightness difference <https://www.nature.com/articles/s41467-020-19160-7/figures/3>`_.
Linearity is defined as having a coefficient of determination (:math:`R^2`)
greater than 0.99 when fitted with linear regression.
When choosing a colormap, those with the :material-regular:`visibility;2em;sd-text-info`
tag should be preferred over those with the :material-regular:`visibility_off;2em;sd-text-warning`
tag.
.. warning::
Many of the ``matplotlib`` colormaps such as ``jet`` are not perceptually
uniform and should be avoided where possible, since these colormaps
can generate misleading visualizations. Colormaps from ``colorcet`` and
``cmocean``, and ``cmcrameri`` are therefore generally recommended over
those from ``matplotlib``.
See `the misuse of colour in science communication <https://doi.org/10.1038/s41467-020-19160-7>`_
and `testing perceptual uniformity <https://colorcet.holoviz.org/user_guide/Continuous.html#testing-perceptual-uniformity>`_
for more information.
Refer to the flowchart in the following dropdown for guidance on how
to choose a colormap.
.. dropdown:: Guideline for choosing the right scientific colormap
.. image:: https://media.springernature.com/full/springer-static/image/art%3A10.1038%2Fs41467-020-19160-7/MediaObjects/41467_2020_19160_Fig6_HTML.png
Figure from Crameri, F., Shephard, G.E., & Heron, P.J. (2020). The misuse of
colour in science communication. Nature Communications, 11, 5444.
https://doi.org/10.1038/s41467-020-19160-7. Licensed under CC BY 4.0.
.. note::
Some colormap names such as ``gray`` and ``rainbow`` are duplicated across
packages, but have slight variations in the mapped colors. Colormaps from
``colorcet`` have priority and are used first if available, followed
by ``cmocean``, followed by the stock colormaps from ``matplotlib``.
.. note::
Install PyVista with ``pyvista[colormaps]`` or ``pyvista[all]`` to also
install the ``colorcet``, ``cmocean``, and ``cmcrameri`` packages.
.. seealso::
:ref:`colormap_example`
Example using colormaps from different sources.
:ref:`named_colors`
Similar reference for named colors.
Linear (Sequential)
-------------------
Colormaps that progress in a single direction, ideal for representing ordered
data such as intensities or magnitudes.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_LINEAR.rst
Diverging
---------
Colormaps with two contrasting colors diverging from a central midpoint, useful
for highlighting deviation from a reference value.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_DIVERGING.rst
Multi-Sequential
----------------
Colormaps with multiple sequential gradients diverging from a midpoint, ideal
for highlighting deviations on both sides of a reference value.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_MULTI_SEQUENTIAL.rst
Cyclic
------
Colormaps designed to wrap around smoothly, best for data that is inherently
circular such as angles and phase.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_CYCLIC.rst
Categorical (Qualitative)
-------------------------
Colormaps using distinct colors for individual categories, suitable for labeling
discrete classes or groups.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_CATEGORICAL.rst
Miscellaneous
-------------
Colormaps that don’t fit neatly into other categories, often used for artistic
or specialized purposes.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_MISC.rst
CET Colormaps
=============
This section includes all ``colorcet`` colormaps that have a named ``CET``
alias (originally from the Center for Exploration Targeting).
Colormap names have the form::
CET_[prefix]{type}{number}[suffix]
Where the prefix and suffix are optional (``[]``) and the type and number are
required (``{}``).
Prefix :
Indicates additional information about color perception.
- ``CB``: Colorblind—safe for red—green color vision deficiency (protanopia/deuteranopia)
- ``CBT``: Colorblind—safe for blue—yellow color vision deficiency (tritanopia)
Type :
The type of colormap.
- ``C``: Cyclic
- ``D``: Diverging
- ``L``: Linear
- ``R``: Rainbow
- ``I``: Isoluminant
Number :
A version number (starting at ``1``) for each unique ``[prefix]{type}`` combination.
Suffix :
Indicates a minor variation of the base colormap.
- ``A``: Alternate version (such as adjusted contrast or hue emphasis)
- ``s``: Shifted version (phase-shifted)
.. note::
Most of the ``colorcet`` colormaps presented above in :ref:`named_colors`
are duplicated here (using their ``CET`` aliases).
Linear (Sequential)
-------------------
Colormaps that progress in a single direction, ideal for representing ordered
data such as intensities or magnitudes.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_CET_LINEAR.rst
Diverging
---------
Colormaps with two contrasting colors diverging from a central midpoint, useful
for highlighting deviation from a reference value.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_CET_DIVERGING.rst
Cyclic
------
Colormaps designed to wrap around smoothly, best for data that is inherently
circular such as angles and phase.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_CET_CYCLIC.rst
Rainbow
-------
Multi-hue colormaps that span the full visible spectrum, useful for highlighting
local differences in sequential data.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_CET_RAINBOW.rst
Isoluminant
-----------
Colormaps with constant perceived brightness, useful for emphasizing shape and
structure without introducing false intensity cues.
.. dropdown::
:open:
.. include:: /api/utilities/colormap_table/colormap_table_CET_ISOLUMINANT.rst
|