flag

Colormap that cycles through red, white, blue and black.

Category: Graphics > Formatting and Annotation

Syntax

map = flag

Returns a colormap with the default number of rows (the size of the current colormap).

map = flag(m)

Returns a colormap with m rows.

Description

The rows repeat the fixed sequence red, white, blue, black, so the map has sharp jumps instead of a gradient. It is meant for flagging distinct regions or for checking how many colors a plot uses, not for continuous data.

Use colormap(flag(8)) to apply it to the current axes.

Input arguments

m
Number of colors, a nonnegative integer.

Output arguments

map
m-by-3 matrix of RGB values between 0 and 1.

Example

Five colors

flag(5)
Output
ans = 5×3

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

See also

colormap prism lines hsv jet