MATLAB scatter
Function
Aug. 31, 2022
Fundamentals
scatter
绘图函数示例:
1
2
3
4
5
6
7
8
9
clc, clear, close
% Points
data = randn(1,20);
% Plot
figure, axes
hold(gca, "on")
scatter(1:numel(data), data, 200, 'rx', LineWidth=2)
其中:
(1)1:numel(data)
和data
分别表示数据点的x-coordinates和y-coordinates;
(2)200
表示marker的大小,必须直接跟在数据点之后;
(3)'rx'
:其中r
表示marker的颜色,x
表示marker的形状;
(4)LineWidth=2
表示marker的粗细;
'filled'
parameter
当使用类似x
这样只有只有face没有edges的marker,使用filled
参数将会什么也不绘制。
1
2
3
4
5
6
7
8
9
clc, clear, close
% Points
data = randn(1,20);
% Plot
figure, axes
hold(gca, "on")
scatter(1:numel(data), data, 200, 'filled', 'rx', LineWidth=2)
There’s noting,而且也不报错。类似marker还有:'+'
, '*'
, '.'
。
References