双翼飞机

双翼飞机

描述

例子

双翼飞机(coefscreates a biplot of the coefficients in the matrixcoefs。如果双单行者为2-D如果coefsHas two columns or 3-D if it has three columns. The axes in the biplot represent the columns ofcoefs,双翼波波特中的向量代表coefs(the observed variables).

例子

双翼飞机(coefs,,,,名称,价值specifies additional options using one or more name-value pair arguments. For example, you can specify“积极”,“真实”限制双皮子到阳性象限(以2-D)或八分(3-D)。

例子

双翼飞机(斧头,,,,___使用由目的斧头。指定斧头as the first input argument followed by any of the input argument combinations in the previous syntaxes.

例子

H= biplot(___将手柄的列向量返回到由图形对象创建的图形对象双翼飞机。利用Hto query and modify properties of specific graphics objects. For more information, see图形对象属性

例子

全部收缩

Create a biplot of the first three principal component coefficients, the observations, and the observed variables for thecarsmall数据集。

加载sample data.

加载carsmall

创建一个由变量组成的矩阵加速度,,,,Displacement,,,,Horsepower,,,,MPG,,,,and重量。删除矩阵中缺少值的行。

X = [加速度位移马力MPG重量];x = rmmissing(x);

标准化Xand perform a principal component analysis.

Z = zscore(X);% Standardized data[coefs,score] = pca(Z);

这5-by-5 matrixcoefs包含主组件系数(每个主组件的一列)。矩阵分数包含主成分得分(观测值)。

创建前三个主要组件系数的双皮子。双皮子的轴代表coefs,双翼波波特中的向量代表coefs

Biplot(COEFS(:,1:3))

通过标记每个变量并绘制前三个主要组件的空间中的观测值来创建一个更详细的双翼飞机。

vbls = {“加速”,,,,'disp',,,,'HP',,,,'mpg',,,,'WGT'};变量的%标签Biplot(COEFS(:,1:3),“得分”,得分(:,1:3),“瓦拉布尔”,,,,vbls);

加载渔业data set, standardize the flower measurements in测量,并执行主组件分析。

加载渔业Z = zscore(meas); [coefs,scores] = pca(Z);

Create a figure with two subplots and return the对象为斧头1and斧头2。Create a biplot in each set of axes by referring to the corresponding目的。在顶部子图中,使用前两个主组件显示双皮子。在底部子图中,使用第三和第四主组件显示双皮子。通过传递相应的对象xlimandYlimfunctions. Change the x-axis and y-axis labels in the bottom plot by passing斧头2toXLABELandylabel

数字('单位',,,,“归一化”,,,,'位置'[0.3 0。3 0.3 0.5]) variables = {“ sepallength”,,,,'SepalWidth',,,,'PetalLength',,,,'PetalWidth'};AX1 =子图(2,1,1);%顶部图双向(AX1,COEFS(:,1:2),“得分”,,,,分数s(:,1:2),“瓦拉布尔”,变量);xlim(ax1,[-1 1])ylim(ax1,[ -  1 1])ax2 =子图(2,1,2);% Bottom subplot双向(AX2,COEFS(:,3:4),“得分”,分数(:,3:4),“瓦拉布尔”,变量);xlim(ax2,[ -  1 1])ylim(ax2,[ -  1 1])xlabel(ax2,'组件3')ylabel(ax2,'组件4'

通过指定支持的行属性名称和值,以及使用句柄来控制双皮子的外观万博1manbetx双翼飞机

加载sample data.

加载carsmall

创建一个由变量组成的矩阵加速度,,,,Displacement,,,,andMPG。删除矩阵中缺少值的行。

x = [加速位移mpg];x = rmmissing(x);

标准化Xand perform a principal component analysis.

Z = zscore(X);% Standardized data[coefs,score] = pca(Z);

这3-by-3 matrixcoefs包含主组件系数(每个主组件的一列)。矩阵分数包含主成分得分(观测值)。

在前两个主要组件的空间中创建一个观测值的双眼。使用Biplot的默认属性。

h = biplot(coefs(:,1:2),“得分”,,,,分数(:,1:2));

H是图形对象的手柄向量。您可以修改由返回的行对象的属性双翼飞机

标记三个变量以易于识别。将圆指定为标记符号,将蓝色作为所有线对象的线颜色。

vbls = {“加速”,,,,'disp',,,,'mpg'};% Array of variable labelsh1 = biplot(coefs(:,1:2),“得分”,得分(:,1:2),。。。'颜色',,,,'b',,,,'Marker',,,,'o',,,,“瓦拉布尔”,,,,vbls);

H1是图形对象的手柄向量。View the first few elements ofH1

H1(1:10)% First ten object handles
ans = 10x1图形数组:线(varline)行(varline)行(varline)行(varmarker)行(varmarker)行(varmarker)line(varmarker)text(varlabel)text(varlabel)text(varlabel)text(varlabel)line(obsmarker)line(obsmarker)

这Handles for the variable labels (H1(7:9))是文字。因此,针对线路属性指定的设置不会影响这些标签。

Create another biplot of the observations in the space of the first two principal components, and label the three variables for easy identification.

h2 = biplot(coefs(:,1:2),“得分”,得分(:,1:2),“瓦拉布尔”,,,,vbls);

H2是图形对象的手柄向量。View the first few elements ofH2

H2(1:10)% First ten object handles
ans = 10x1图形数组:线(varline)行(varline)行(varline)行(varmarker)行(varmarker)行(varmarker)line(varmarker)text(varlabel)text(varlabel)text(varlabel)text(varlabel)line(obsmarker)line(obsmarker)

H2包含104个对象手柄。

  • 前三个把手(h(1:3))correspond to line handles for the three variables.

  • 手柄h(4:6)correspond to marker handles for the three variables.

  • 手柄H(7:9)correspond to text handles for the three variables.

  • 接下来的94个手柄对应于观测值的线手柄。

  • 最后一个手柄对应于轴线的线手柄。

通过将手柄用于图形对象来修改双翼点的特定属性。

Change the line color of the variables (vectors).

为了k = 1:3 h2(k).Color ='r';%将红色指定为线颜色结尾

Modify the font of the variable labels.

为了k = 7:9 h2(k).fontweight ='bold';% Specify bold font结尾

Change the color of the observation markers.

为了k = 10:103 h2(k).markeredGecolor ='K';% Specify black color for the observations结尾

输入参数

全部收缩

Coefficients, specified as a matrix that has two or three columns. Ifcoefs有两个列,然后双皮子为2-D;如果coefsHas three columns, then the biplot is 3-D. The columns ofcoefsusually contain principal component coefficients created withPCAorPCACOV,,,,or factor loadings estimated with因子。这斧头es in the biplot represent columns ofcoefs,,,,and the vectors in the biplot represent rows ofcoefs(the observed variables).

Data Types:single|double

轴为了the plot, specified as an目的。如果您不指定斧头, 然后双翼飞机使用当前轴创建图。有关创建的更多信息目的,,,,see斧头es

名称值对参数

指定可选的逗号分隔对名称,价值参数。Name是参数名称和Valueis the corresponding value.Name必须出现在引号中。您可以按任何顺序指定几个名称和值对参数NAME1,Value1,...,Namen,Valuen

例子:双翼飞机(coefs,'VarLabels',varlabels)labels each vector (variable) with the text in the arrayvarlabels

Scores, specified as the comma-separated pair consisting of“得分”和一个具有相同数量列的矩阵coefsScoresusually contains principal component scores created withPCA或估计的因素分数因子。这双翼飞机function represents each row ofScores(观察)作为点,每行coefs(观察到的变量)作为向量。

例子:“得分”,,,,分数(:,1:3)

Data Types:single|double

Variable labels, specified as the comma-separated pair consisting of“瓦拉布尔”以及字符数组,字符串数组或单元格数组。双翼飞机labels each vector (observed variable) with the text in the array.

例子:“ Varlabels”,Varlabels

Data Types:char|string|细胞

观察标签,指定为逗号分隔对'ObsLabels'以及字符数组,字符串数组或单元格数组。双翼飞机显示数据光标时,将数组中的文本用作观察名称。

例子:“粘贴标签”,粘贴标签

Data Types:char|string|细胞

Indicator for plotting in the positive coordinates, specified as the comma-separated pair consisting of'积极的'这些逻辑值之一。

Value 描述
错误的

Creates the biplot over the range+/ - 麦克斯(COEFS(:))对于所有坐标(默认)

true

将双皮子限制为正象限(以2-D)或八分(以3-D为单位)

例子:“积极”,真的

Data Types:逻辑

属性名称,指定为逗号分隔对,由一个或多个支持的属性名称及其关联的值组成万博1manbetxLine Properties。这些属性是由所有原始线图形对象的名称和值双翼飞机。这specified property names control the appearance and behavior of the graphics objects.

例子:“标记”,“正方形”,“ Markersize”,10

Output Arguments

全部收缩

手柄to the graphics objects created by双翼飞机,作为列向量返回。该向量包含以下顺序:

  1. 手柄corresponding to variables (line handles first, followed by marker handles then text handles)

  2. 手柄corresponding to observations (marker handles first, followed by text handles)

  3. 手柄corresponding to the axis lines

您可以使用手柄查询和修改特定图形对象的属性。看图形对象处理and图形数组更多细节。

算法

双皮子允许您可视化每个变量对前两个或三个主组件的贡献的幅度和符号,并以这些组件表示每个观察结果。这双翼飞机功能:

  • 施加标志约定,迫使每列的元素最大的元素coefs积极。此动作翻转了一些向量coefsto the opposite direction, but often makes the plot easier to read. Interpretation of the plot is unaffected, because changing the sign of a coefficient vector does not change its meaning.

  • 缩放分数使其适合情节。也就是说,该函数将每个分数除以所有分数的最大绝对值,而乘以最大系数长度coefs。这n双翼飞机根据系数的符号大会更改得分坐标的符号。

Introduced before R2006a