matlab绘制散点图标记
时间: 2023-06-14 15:05:09 浏览: 138
在MATLAB中,可以使用scatter函数绘制散点图,并使用text函数在散点上添加标记。
例如,假设有以下数据:
```matlab
x = randn(50,1);
y = randn(50,1);
labels = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
```
使用scatter函数绘制散点图:
```matlab
scatter(x,y)
```
添加标记:
```matlab
text(x,y,labels)
```
完整代码:
```matlab
x = randn(50,1);
y = randn(50,1);
labels = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
scatter(x,y)
text(x,y,labels)
```
阅读全文