colorcube

Returns the colorcube colormap, a set of regularly spaced RGB colors.

Category: Graphics > Formatting and Annotation

Syntax

map = colorcube

Returns the colormap with as many rows as the current colormap.

map = colorcube(m)

Returns an m-by-3 colormap.

Description

Each row of the result is one color, ordered from the lowest to the highest data value. Pass the matrix to colormap to apply it, as in colormap(colorcube(64)). A smaller m gives visibly distinct bands, which suits contour-like displays. The colors are chosen to sample the RGB cube with extra steps of gray and of the pure primary and secondary colors, so neighboring entries are not smooth gradients.

Input arguments

m
Number of colors. The default is the number of rows of the current colormap.

Output arguments

map
Matrix with m rows and three columns. Each row is an RGB triplet with values between 0 and 1.

Example

Three colors

colorcube(8)
Output
ans = 8×3

     1     1     0
     0     1     1
     1     0     1
     1     0     0
     0     1     0
     0     0     1
     0     0     0
     1     1     1

See also

colormap colorbar parula jet hsv lines