www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/SpecifyLineStyleAndColorExample.m

    %% Specify Line Style and Color
% This example shows how to specify the line styles and line colors for a
% plot.
%
% Plot a sine wave with a green dashed line using |'--g'|. Plot a
% second sine wave with a red dotted line using |':r'|. The elements of the
% line specification can appear in any order.

x = linspace(0,2*pi,100);
y1 = sin(x);
y2 = sin(x-pi/4);

figure
plot(x,y1,'--g',x,y2,':r')