ColorSpec
is not a command, rather it refers to the three ways in which you specify color in MATLAB:
------------------------------- RGB Value Short Name Long Name ------------------------------- [1 1 0] y yellow [1 0 1] m magenta [0 1 1] c cyan [1 0 0] r red [0 1 0] g green [0 0 1] b blue [1 1 1] w white [0 0 0] k black -------------------------------The RGB triple is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0 1].
When you specify an RGB triple that is not one of the eight listed above, MATLAB allocates a slot in the system color table for the new color. Colors defined in this way are true colors as opposed to colors mapped to the closest entry that already exists in the color table.
The eight predefined colors and any that you specify as RGB values are not part of the figure colormap, nor are they affected by changes to the figure colormap. They are referred to a fixed colors, as opposed to colormap colors.
You can use aplot(xdata,ydata,'g')
plot(xdata,ydata,'green')
h = plot(xdata,ydata);
set(h,'Color',[0 1 0])
ColorSpec
anywhere you need to define a color. For example, this statement changes the figure background color to pink:
set(gcf,'Color',[1 .4 .6])
colormap
(c) Copyright 1994 by The MathWorks, Inc.