1. matlab 中线条的主要属性
- Color: 颜色
- LineStyle: 线型
- LineWidth: 线宽
- Marker: 标记点的形状
- MarkerFaceColor: 标记点填充颜色
- MarkerEdgeColor: 标记点边缘颜色
- MarkerSize: 标记点大小
2. 各种属性的名称
2.1 线型
-Solid line (default)
– Dashed line
: Dotted line
-. Dash-dot line
2.2 颜色
r Red
g Green
b Blue
c Cyan
m Magenta
y Yellow
k Black
w White
2.3 数据点的形状
a+ Plus sign
o Circle
a* Asterisk
. Point
x Cross
‘square’ or s Square
‘diamond’ or d Diamond
^ Upward-pointing triangle
v Downward-pointing triangle
a> Right-pointing triangle
‘pentagram’ or p Five-pointed star (pentagram)
‘hexagram’ or h Six-pointed star (hexagram)
3. 举例
x = [-2*pi:0.01:2*pi];
y1 = sin(x);
y2 = cos(x);figure; % 打开一个画板% 画两条线,返回的是这两条线的句柄,h是一个包含两个句柄的数组
h = plot(x,y1,x,y2); % 根据句柄设置线条属性
set(h(1),'LineWidth',2)
% set(h(2),'Marker','*')
set(h(1),'Color',[0.6 0 1])
% set(h(1),'LineStyle',':')
% set(h(2),'MarkerFaceColor',[0 0 1],'MarkerEdgeColor',[0.6 0.6 0.6])
% set(h(2),'MarkerSize',2)