orderedcolors

Returns a named set of distinct colors, such as the default line colors.

Category: Graphics > Formatting and Annotation

Syntax

C = orderedcolors(scheme)

Returns the colors of the named scheme as an n-by-3 matrix of RGB values.

Description

The colors are chosen to be told apart easily and are listed in the order in which they should be used. The scheme 'gem' is the default color order of the axes, which is why lines and orderedcolors('gem') return the same values.

The matrix can be assigned to the ColorOrder property of an axes to change the colors of the lines drawn next, or sampled to color bars and markers by hand.

Input arguments

scheme
Name of a color scheme, for example 'gem', 'gem12', 'glow', 'sail', 'earth', 'reef' or 'meadow'.

Output arguments

C
Matrix with one RGB row per color. The 'gem' scheme gives 7 rows and 'gem12' gives 12.

Example

The default color order

C = orderedcolors('gem')
size(orderedcolors('gem12'))
Output
C = 7×3

         0    0.4470    0.7410
    0.8500    0.3250    0.0980
    0.9290    0.6940    0.1250
    0.4940    0.1840    0.5560
    0.4660    0.6740    0.1880
    0.3010    0.7450    0.9330
    0.6350    0.0780    0.1840
ans = 1×2

    12     3

See also

lines colororder colormap hsv parula