翻译自 MATLAB 官方文档
文章目录
- scatter : 散点图
- [stem : 茎干图, 绘制离散序列数据](https://ww2.mathworks.cn/help/matlab/ref/stem.html)
- [stem3](https://ww2.mathworks.cn/help/matlab/ref/stem3.html)
- [stairs : 阶梯图](https://ww2.mathworks.cn/help/matlab/ref/stairs.html)
- [spy:稀疏矩阵可视化](https://ww2.mathworks.cn/help/matlab/ref/spy.html)
- [plotmatrix: 散点图矩阵](https://ww2.mathworks.cn/help/matlab/ref/plotmatrix.html)
- [heatmap: 热度图](https://ww2.mathworks.cn/help/matlab/ref/heatmap.html)
- [wordcloud : 文字云图](https://ww2.mathworks.cn/help/matlab/ref/wordcloud.html)
- [geobubble : 以可视方式呈现特定地理位置的数据值](https://ww2.mathworks.cn/help/matlab/ref/geobubble.html)
- [geolimits : 设置或查询地理范围](https://ww2.mathworks.cn/help/matlab/ref/geolimits.html)
scatter : 散点图
Function
Input
输入为一系列的点坐标
数组形式给的点坐标转换为MATLAB的(x,y,z)
pts = [1,2,3,4,5,6,7,8,9];
x = pts(1:3:end);
y = pts(2:3:end);
z = pts(3:3:end);
矩阵形式给的点坐标转换为MATLAB的(x,y,z)
pts = [[1 2 3]; [4,5,6]; [7 8 9]];
x = pts(:,1);
y = pts(:,2);
z = pts(:,3);
Cases
pts = rand(10,3);
x = pts(:,1);
y = pts(:,2);
z = pts(:,3);
scatter3(x,y,z, 'filled')
标记类型
标记颜色
stem : 茎干图, 绘制离散序列数据
figure
X = linspace(0,2*pi,50)';
Y = [cos(X), 0.5*sin(X)];
stem(Y)
stem3
figure
X = linspace(-5,5,60);
Y = cos(X);
Z = X.^2;
stem3(X,Y,Z)
view(-8,30)
stairs : 阶梯图
X = linspace(0,4*pi,50)';
Y = [0.5*cos(X), 2*cos(X)];
figure
stairs(Y)
spy:稀疏矩阵可视化
B = bucky;
spy(B)
此示例绘制 Buckminster Fuller 多面穹顶的连接图形的 60×60 稀疏邻接矩阵。此矩阵还代表足球和碳 60 分子。
plotmatrix: 散点图矩阵
X = randn(50,3);
plotmatrix(X)
矩阵的第 i 行、第 j 列中的子图是 X 的第 i 列相对于 X 的第 j 列的散点图。沿对角线方向是 X 的每一列的直方图。
heatmap: 热度图
load patients
tbl = table(LastName,Age,Gender,SelfAssessedHealthStatus,...
Smoker,Weight,Location);
h = heatmap(tbl,'Smoker','SelfAssessedHealthStatus');