Setting Colors on Graph
MATLAB provides eight basic color options for drawing graphs. The following table shows the colors and their codes:
w- White
k - Black
b - Blue
r - Red
c - Cyan
g - Green
m - Magenta
y - Yellow
Example
Plot three sine curves with a small phase shift between each line. Use a green line with no markers for the first sine curve. Use a blue dashed line with circle markers for the second sine curve. Use only cyan star markers for the third sine curve.
x = 0:pi/10:2*pi; y1 = sin(x); y2 = sin(x-0.25); y3 = sin(x-0.5); figure plot(x,y1,'g',x,y2,'b--o',x,y3,'c*')
No comments:
Post a Comment