Main Content

redgreencmap

Create red and green colormap

Description

example

redgreencmap(length) returns a length-by-3 matrix containing a red and green colormap. Low values are bright green, values in the center of the map are black, and high values are red.

example

redgreencmap(length,'Interpolation',interpMethod) specifies the algorithm to use for color interpolation.

Examples

collapse all

Read in a sample GPR file.

madata = gprread('mouse_a1wt.gpr');

Plot the median foreground intensity for the 635 nm channel.

maimage(madata,'F635 Median')

Figure contains an axes object. The axes object with title F635 Median contains 5 objects of type image, line.

Alternatively, create a similar plot using more basic graphics commands.

F635Median = magetfield(madata,'F635 Median');
figure
imagesc(F635Median(madata.Indices));

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

Change the colormap to one of the preset colors (for details, see map) and add a color bar.

colormap('bone')
colorbar 

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

Change the colormap to red and green.

colormap(redgreencmap)

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

You can also change the color interpolation method.

colormap(redgreencmap(256,'Interpolation','cubic'))

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

Reset the colormap to the default value.

colormap('default')

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

Input Arguments

collapse all

Number of colors in the colormap, specified as empty [] or a nonnegative integer. If length is empty, the function automatically sets the value to the length of the colormap of the current figure.

Example: 64

Data Types: double

Interpolation algorithm for color interpolation, specified as 'sigmoid' (which uses tanh), 'linear', 'quadratic', or 'cubic'.

Example: 'cubic'

Data Types: char | string

Version History

Introduced before R2006a