Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical & Research SuppliesReagents, PPE & instruments — chain-of-custody documented.Fast, traceable sourcing built for regulated research environments, from bench consumables to instrumentation.Shop lac.us CodeCASRAIlac.us

MATLAB Colormap Colors: Built-In Maps, Custom RGB Maps, Colorbars

Built-in MATLAB colormaps with release notes, custom three-column RGB maps, colorbar commands and free alternatives, from the official documentation.

Written and maintained by CASRAI Editorial Board

Last updated

A MATLAB colormap is an m-by-3 matrix of red, green, blue values that tells MATLAB which color to draw for each data value in a surface, image, contour or scatter plot. This guide is for researchers and analysts who need to pick a built-in map, build their own, and add a colorbar so the figure can be read. The default map is parula; you change it with the colormap function.

What colormaps are used for in research figures

Any plot that encodes a third variable as color (heat maps, surface plots, spectrograms, image data) depends on its colormap to be readable. MathWorks documents parula, the default, as having transitions between colors that are “more perceptually uniform than in most other colormaps,” and documents turbo as a scheme similar to jet with transitions more perceptually uniform than in jet. Perceptual uniformity matters because equal steps in the data should look like equal steps in color; the Matplotlib documentation states the same principle: a perceptually uniform colormap is “a colormap in which equal steps in data are perceived as equal steps in the color space.” For journal figure requirements beyond color, see scientific figure rules for journal submission and designing effective scientific figures.

Access: where the colormap functions come from

The colormap, colorbar, parula and turbo functions are documented in the core MATLAB reference on the MathWorks documentation site (colormap, turbo, colorbar; checked 2026-11-07). Obtain MATLAB only from MathWorks. Several maps were added in specific releases (see the table below), so a map missing from an older installation may simply be newer than that release.

Built-in MATLAB colormaps

The colormap reference page lists these predefined colormaps. Release notes are included only where the MathWorks pages state them.

Colormap What the documentation says
parula Default colormap unless you specify otherwise; transitions more perceptually uniform than in most other colormaps
turbo Introduced in R2020b; similar color scheme to jet with more perceptually uniform transitions than jet
jet Predefined colormap; the turbo page compares itself against it
sky Added in R2023a
abyss Added in R2023b
nebula Added in R2025a
hsv, hot, cool, spring, summer, autumn, winter, gray, bone, copper, pink, lines, colorcube, prism, flag, white Predefined colormaps listed on the reference page

Step by step: set a colormap and add a colorbar

  1. Create a plot. For example, surf(peaks) draws a surface colored by height.
  2. Apply a predefined colormap. Call colormap(turbo). The command form colormap turbo is also documented (colormap map).
  3. Set the number of colors. Predefined maps take a length, for example colormap(parula(5)) for five colors.
  4. Target a specific axes or figure. Use colormap(target,map).
  5. Read the current map. cmap = colormap returns the current colormap as a matrix; cmap = colormap(target) returns it for a given target.
  6. Add a colorbar. Call colorbar to add a vertical colorbar to the right of the current axes. Use colorbar('northoutside') to choose a location, c = colorbar to get the ColorBar object for further changes, and colorbar('off') to remove it.
  7. Reverse the colorbar direction if needed. colorbar(Direction="reverse") uses the documented name-value syntax.
  8. Restore the default. colormap default returns to the system default colormap.

Custom colormaps (custom RGB)

The documentation says a colormap “can be any length, but must be three columns wide.” Each row is one color, with red, green and blue intensities as doubles or singles from 0 to 1 (uint8 values from 0 to 255 are also accepted). The documented example builds a six-color blue ramp and applies it:

map = [0 0 0.3; 0 0 0.4; 0 0 0.5; 0 0 0.6; 0 0 0.8; 0 0 1.0];
surf(peaks)
colormap(map)
colorbar

The same matrix shape works for any number of rows, so a custom map can also be generated by code and passed straight to colormap.

Output and how to read it

After colormap runs, the plot recolors immediately; the colorbar shows which color maps to which data value. A colorbar is part of the evidence in the figure, so label it with the quantity and units. A matching Python walkthrough is in colorbar in Matplotlib, and heatmap in Matplotlib shows the same idea for gridded data.

Troubleshooting

Why does my custom colormap fail?

Check the matrix shape first: it must be three columns wide (red, green, blue), with values from 0 to 1 for double or single data.

Why did my colors revert to the default?

If no other default is set, the default colormap is parula. colormap default restores it.

Why is a map name not recognized?

The newer maps (sky, abyss, nebula) were added in R2023a, R2023b and R2025a respectively, and turbo in R2020b. Older releases will not have them.

How do I get a colorbar off the figure?

colorbar('off') removes it.

Viridis, magma, inferno and coolwarm in MATLAB

These four names do not appear in the predefined list on the MATLAB colormap reference page (checked 2026-11-07). The maps themselves are documented elsewhere: Matplotlib lists viridis, plasma, inferno, magma and cividis as perceptually uniform sequential colormaps and coolwarm among its diverging maps, noting that coolwarm “has little range of gray scale and would print to a more uniform plot, losing a lot of detail.” In MATLAB, the documented way to use any map you have as RGB values is the custom three-column matrix route above, or a third-party File Exchange package, which MathWorks does not document on the reference page.

Free alternatives

Tool Colormap support (from its documentation)
GNU Octave colormap function; map = viridis () or viridis (n) creates a map running from dark purplish-blue through blue and green to yellow; colormap ("default") restores the default, a 64-entry viridis map
Python Matplotlib Perceptually uniform sequential maps viridis, plasma, inferno, magma, cividis; diverging maps include coolwarm

FAQ

What is the default colormap in MATLAB?

Parula, unless you specify a different default. colormap default restores it.

Is viridis built into MATLAB?

It is not in the predefined list on the colormap reference page. Use a custom RGB matrix or a File Exchange package.

How do I make a custom colormap?

Create a matrix with three columns (red, green, blue), values from 0 to 1, any number of rows, then call colormap(map).

What is a perceptually uniform colormap?

One in which equal steps in the data are perceived as equal steps in color (Matplotlib documentation). MathWorks describes parula and turbo as more perceptually uniform than most other maps and than jet, respectively.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about MATLAB Colormap Colors: Built-In Maps, Custom RGB Maps, Colorbars

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →