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

    %% Specify Line Style, Color, and Markers
% This example shows how to specify the line style, color, and markers for
% two sine waves. If you specify a marker type, then |plot| adds a marker
% to each data point.
% 
% Define |x| as 25 linearly spaced values between 0 and $2\pi$. Plot the
% first sine wave with a green dashed line and circle markers using
% |'--go'|. Plot the second sine wave with a red dotted line and star
% markers using |':r*'|. 

% Copyright 2015 The MathWorks, Inc.


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

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