Matlab drawing
Choice of line shape, color, data point shape
1. Linear
- Solid line (default)
-- Dashed line
: Dotted line
-. Dash-dot line
2. Color
r Red
g Green
b Blue
c Cyan
m Magenta
y Yellow
k Black
w White
3. The shape of the data points
+ Plus sign
o Circle
* Asterisk
. Point
x Cross
'square' or s Square
'diamond' or d Diamond
^ Upward-pointing triangle
v Downward-pointing triangle
> Right-pointing triangle
'pentagram' or p Five-pointed star (pentagram)
'hexagram' or h Six-pointed star (hexagram)
4. Examples
Plot the sine function over three different ranges using different line styles, colors, and markers.
t = 0:pi/20:2pi;
plot(t,sin(t),'-.r')
hold on
plot(t,sin(t-pi/2),'--mo')
plot(t,sin(t-pi),':bs')
hold off
5, the appendix, summarized as:
line type |
illustrate |
marker |
illustrate |
colour |
illustrate |
- |
solid line (default) |
+ |
plus sign |
r |
Red |
-- |
double dash |
O |
hollow circle |
g |
green |
: |
dotted line |
* |
Asterisk |
b |
blue |
:. |
Dotted line |
. |
filled circle |
c |
green |
x |
cross sign |
m |
magenta |
||
s |
square |
and |
yellow |
||
d |
diamond |
k |
black |
||
^ |
upper triangle |
w |
White |
||
v |
lower triangle |
||||
> |
right triangle |
||||
< |
left triangle |
||||
p |
Pentagram |
||||
h |
hexagon |