colororder

Gets or sets the list of colors used to draw successive lines.

Category: Graphics > Formatting and Annotation

Syntax

colororder(newcolors)

Sets the color order from an RGB matrix.

colororder(name)

Sets a named palette such as 'gem', 'default', 'sail'.

C = colororder

Returns the current colors.

Description

When several lines are drawn in the same axes, each takes the next color in this list, and the list repeats after the last. Set it before plotting to control the palette of the whole figure.

Input arguments

newcolors
n-by-3 matrix of RGB values between 0 and 1.

Output arguments

C
n-by-3 matrix with the color order.

Example

Two-color cycle

colororder([1 0 0; 0 0 1])
plot(1:5)
hold on
plot(5:-1:1)
disp(colororder)
Output
     1     0     0
     0     0     1

See also

colormap plot hold lines