Main Content


Rotate colormap colors


spinmap rotates the current colormap by two rows repeatedly for approximately three seconds.

spinmap(t) rotates the current colormap by two rows repeatedly for t seconds.


spinmap(t,n) rotates the current colormap by n rows for t seconds.


collapse all

Create a surface plot that uses the default colormap. Then rotate the colormap by one row for five seconds.


Figure contains an axes. The axes contains an object of type surface.

Input Arguments

collapse all

Rotation duration, specified as a scalar numeric value or 'inf'. A numeric value specifies the number of seconds to rotate the colormap. A value of 'inf' makes the colormap rotate indefinitely.

Rotation amount, specified as a numeric scalar value. The first rotation shifts each color in the colormap by n rows. Subsequent rotations shift the colormap by an additional n rows.

Positive values increment the rows, where the last color wraps to the first row. A negative value decrements the rows, where the first color wraps to the last row.


Press Ctrl+C to interrupt the rotation before t has elapsed.

Introduced before R2006a