MATLAB Examples

Specify Marker Size and Color

Create a line plot with markers. Customize the markers by setting these properties using name-value pair arguments with the plot function:

  • MarkerSize - Marker size, which is specified as a positive value.
  • MarkerEdgeColor - Marker outline color, which is specified as a color name or an RGB triplet.
  • MarkerFaceColor - Marker interior color, which is specified as a color name or an RGB triplet.

Specify the colors using either a character vector of a color name, such as 'red', or an RGB triplet, such as [0.4 0.6 0.7]. An RGB triplet 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].

x = linspace(0,10,50);
y = sin(x);
plot(x,y,'-s','MarkerSize',10,...
    'MarkerEdgeColor','red',...
    'MarkerFaceColor',[1 .6 .6])