23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2ColorSpec<br />

Purpose Color specification<br />

ColorSpec<br />

Description ColorSpec is not a command; it refers to the three ways in which you specify<br />

color in <strong>MATLAB</strong>:<br />

• RGB triple<br />

• Short name<br />

• Long name<br />

The short names and long names are <strong>MATLAB</strong> strings that specify one of eight<br />

predefined colors. The RGB triple is a three-element row vector whose<br />

elements specify the intensities of the red, green, and blue components of the<br />

color; the intensities must be in the range [0 1]. The following table lists the<br />

predefined colors and their RGB equivalents.<br />

RGB Value Short Name Long Name<br />

[1 1 0] y yellow<br />

[1 0 1] m magenta<br />

[0 1 1] c cyan<br />

[1 0 0] r red<br />

[0 1 0] g green<br />

[0 0 1] b blue<br />

[1 1 1] w white<br />

[0 0 0] k black<br />

Remarks The eight predefined colors and any colors you specify as RGB values are not<br />

part of a figure’s colormap, nor are they affected by changes to the figure’s<br />

colormap. They are referred to as fixed colors, as opposed to colormap colors.<br />

Examples To change the background color of a figure to green, specify the color with a<br />

short name, a long name, or an RGB triple. These statements generate<br />

equivalent results:<br />

whitebg('g')<br />

2-289

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!