colororder
Set or query color order palette
Syntax
Description
Set Colors
colororder(
sets the palette for
the current figure's color order. The color order controls the
ordering of the colors MATLAB® uses for plotting multiple data series within an axes.colorarray
)
Specify colorarray
as a matrix of RGB triplets or an array of color
names such as ["red" "green" "blue"]
. If a figure does not exist,
MATLAB creates a figure and sets the palette for that figure. When you set the
palette for a figure, you set the palette for all the axes within that figure.
colororder(
specifies the colors as
one of the predefined palette names, such as palettename
)"gem"
,
"glow"
, or "sail"
. (since R2023b)
Examples
Input Arguments
Tips
When you set the color order for a figure, the colors persist when you call a plotting function. However, if you pass an axes object to the
colororder
function, you must first callhold on
to make the colors persist when you call a plotting function.If you set the
ColorOrderIndex
orLineStyleOrderIndex
property on the axes, the new color order does not affect existing plots. The new colors take effect only after you callhold on
and then call a plotting function.