Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
Cover
Basic usage : one matrix input
% Load Fisher's iris dataset (150 samples, 4 features, 3 species)
% 加载鸢尾花数据集(150个样本,4个特征,3个品种)
fisher = load("fisheriris.mat");
X = fisher.meas; % 150×4 feature matrix / 特征矩阵
group = fisher.species; % Species labels / 品种标签
label = {'sepal-length', 'sepal-width', 'petal-length', 'petal-width'};
% Create pairplot object with customized visualization
% 创建散点图矩阵对象,自定义可视化风格
SP = SPairplot(X, 'Group', group, 'DiagType', 1, 'UpperType', 9, 'LowerType', 2);
SP.draw();
% Set X-labels and Y-labels
% 设置 X 轴标签和 Y 轴标签
SP.setXLabelString(label);
SP.setYLabelString(label);
DiagType
UpperType and LowerType
Basic usage : two matrix input
% Generate synthetic data with three groups (150 samples, 6 features total)
% 生成包含三个分组的合成数据(150个样本,共6个特征)
P1 = mvnrnd([0,20,0,10,8,7], eye(6).*6, 50);
P2 = mvnrnd([10,5,15,0,4,2], eye(6).*8, 50);
P3 = mvnrnd([10,15,0,0,2,3], eye(6).*[3,9,2,1,4,4], 50);
G = [ones(50,1)*1; ones(50,1)*2; ones(50,1)*3]; % Group labels / 分组标签
% Split into X (first 3 variables) and Y (last 3 variables)
% 拆分为 X(前3个变量)和 Y(后3个变量)
XY = [P1; P2; P3];
X = XY(:, 1:3);
Y = XY(:, 4:6);
% Create pairplot with two variable sets (X vs Y)
% 创建双变量集的散点图矩阵(X 与 Y 的对比)
% Note: When X and Y are both provided, only LowerType (off-diagonal below)
% is effective. Upper triangle and diagonal are automatically disabled.
% 注意:当同时输入 X 和 Y 时,仅 LowerType(下三角区域)生效,
% 上三角和对角线区域自动禁用。
SP = SPairplot(X, Y, 'Group', G, 'LowerType', 9);
SP.draw();
Properties setting for subplots
fisher = load("fisheriris.mat");
X = fisher.meas;
group = fisher.species;
label = {'sepal-length', 'sepal-width', 'petal-length', 'petal-width'};
SP = SPairplot(X, 'Group', group, 'DiagType', 1, 'UpperType', 9, 'LowerType', 2);
% set CData
SP.CData = [119,69,133; 56,108,155; 33,160,122] ./ 255;
SP.draw();
% Set X-labels and Y-labels
SP.setXLabelString(label);
SP.setYLabelString(label);
% Customize subplot appearance
% 自定义子图外观
SP.setAxes('Box','off', 'LineWidth',1.5, 'XGrid','on', 'YGrid','on')
SP.setXLabel('FontWeight','bold', 'Color',[0,0,.8])
SP.setYLabel('FontWeight','bold', 'Color',[.8,0,0])
Legend
fisher = load("fisheriris.mat");
X = fisher.meas;
group = fisher.species;
class = unique(group, 'stable');
label = {'sepal-length', 'sepal-width', 'petal-length', 'petal-width'};
SP = SPairplot(X, 'Group', group, 'DiagType', 1, 'UpperType', 9, 'LowerType', 2);
% set CData
SP.CData = [211, 43, 43; 61, 96,137; 249,206, 61; 76,103, 86; 80, 80, 80]./255;
SP.padding = [.08, .08, .2, .04];
SP.draw();
% Set X-labels and Y-labels
SP.setXLabelString(label);
SP.setYLabelString(label);
legend(SP.axMat{4, 4}, class, 'FontSize',17, 'Position',[.82, .88, .12, .08])
Zitieren als
Zhaoxu Liu / slandarer (2026). pairplot (scatter plot matrix | 散点图矩阵) (https://de.mathworks.com/matlabcentral/fileexchange/184069-pairplot-scatter-plot-matrix), MATLAB Central File Exchange. Abgerufen .
Allgemeine Informationen
- Version 1.0.0 (2,95 MB)
Kompatibilität der MATLAB-Version
- Kompatibel mit allen Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.0.0 |
