Matlab矩阵散点图绘制函数plotmatrix

您所在的位置:网站首页 matlab矩阵绘图 Matlab矩阵散点图绘制函数plotmatrix

Matlab矩阵散点图绘制函数plotmatrix

#Matlab矩阵散点图绘制函数plotmatrix| 来源: 网络整理| 查看: 265

4.4 (5)

今天,给各位带来Matlab中,使用plotmatrix绘制矩阵散点图的相关教程说明。本文主要介绍plotmatrix函数在Matlab中的常见用法、语法说明、使用两个矩阵输入创建散点图矩阵、使用一个矩阵输入创建散点图矩阵、指定标记类型和颜色,以及创建并修改散点图矩阵等用法。

Matlab矩阵散点图绘制函数plotmatrix

下面我们将开始非常详细的 Matlab plotmatrix 函数语法介绍,实例引用,结果展示。首先,我们给出 Matlab 中关于 plotmatrix 函数的帮助文本如下:

>> help plotmatrix plotmatrix Scatter plot matrix. plotmatrix(X,Y) scatter plots the columns of X against the columns of Y. If X is P-by-M and Y is P-by-N, plotmatrix will produce a N-by-M matrix of axes. plotmatrix(Y) is the same as plotmatrix(Y,Y) except that the diagonal will be replaced by HISTOGRAM(Y(:,i)). plotmatrix(...,'LineSpec') uses the given line specification in the string 'LineSpec'; '.' is the default (see PLOT for possibilities). plotmatrix(AX,...) uses AX as the BigAx instead of GCA. [H,AX,BigAx,P,PAx] = plotmatrix(...) returns a matrix of handles to the objects created in H, a matrix of handles to the individual subaxes in AX, a handle to big (invisible) axes that frame the subaxes in BigAx, a vector of handles for the histogram plots in P, and a vector of handles for invisible axes that control the histogram axes scales in PAx. BigAx is left as the CurrentAxes so that a subsequent TITLE, XLABEL, or YLABEL will be centered with respect to the matrix of axes. Example: x = randn(50,3); y = x*[-1 2 1;2 0 1;1 -2 3;]'; plotmatrix(y)常见用法plotmatrix(X,Y) plotmatrix(X) plotmatrix(___,LineSpec) [S,AX,BigAx,H,HAx] = plotmatrix(___)语法说明

plotmatrix(X,Y) 创建一个子坐标区矩阵,包含了由 X 的各列相对 Y 的各列数据组成的散点图。如果 X 是 p×n 且 Y 是 p×m,则 plotmatrix 生成一个 n×m 子坐标区矩阵。

除了用 X 对应列中数据的直方图替换对角线上的子坐标区外,plotmatrix(X) 与 plotmatrix(X,X) 相同。例如,用 histogram(X(:,i)) 替换了第 i 列中对角线上的子坐标区。

plotmatrix(___,LineSpec) 指定散点图的线型、标记符号和颜色。选项 LineSpec 可以位于前述语法中的任何输入参数组合之后。

[S,AX,BigAx,H,HAx] = plotmatrix(___) 按以下方式返回创建的图形对象:

S – 散点图的图形线条对象AX – 每个子坐标区的坐标区对象BigAx – 容纳子坐标区的主坐标区的坐标区对象H – 直方图的直方图对象HAx – 不可见的直方图坐标区的坐标区对象

BigAx 被当作当前坐标区 (gca),因此后续的 title、xlabel 或 ylabel 命令都将依此主坐标区使文本居中。

使用两个矩阵输入创建散点图矩阵

创建一个由随机数据组成的矩阵 X,以及一个由整数值组成的矩阵 Y。然后,创建 X 的各列对 Y 的各列的散点图矩阵。

X = randn(50,3); Y = reshape(1:150,50,3); plotmatrix(X,Y)Matlab矩阵散点图绘制函数plotmatrix

图窗的第 i 行、第 j 列中的子图是 Y 的第 i 列相对于 X 的第 j 列的散点图。

使用一个矩阵输入创建散点图矩阵

创建包含随机数据的散点图矩阵。矩阵的第 i 行、第 j 列中的子图是 X 的第 i 列相对于 X 的第 j 列的散点图。沿对角线方向是 X 的每一列的直方图。

X = randn(50,3); plotmatrix(X)Matlab矩阵散点图绘制函数plotmatrix指定标记类型和颜色

创建包含随机数据的散点图矩阵。指定散点图的标记类型和颜色。

X = randn(50,3); plotmatrix(X,'*r')Matlab矩阵散点图绘制函数plotmatrix

LineSpec 选项设置散点图的属性。要设置直方图的属性,需返回直方图对象。

创建并修改散点图矩阵

创建包含随机数据的散点图矩阵。

rng default X = randn(50,3); [S,AX,BigAx,H,HAx] = plotmatrix(X);Matlab矩阵散点图绘制函数plotmatrix

要设置散点图的属性,请使用 S。要设置直方图的属性,请使用 H。要设置坐标区属性,请使用 AX、BigAx 和 HAx。使用圆点表示法设置属性。

在图窗的左下角设置散点图的颜色和标记类型。设置位于右下角的直方图的颜色。使用 title 命令为图窗添加标题。

S(3).Color = 'g'; S(3).Marker = '*'; H(3).EdgeColor = 'k'; H(3).FaceColor = 'g'; title(BigAx,'A Comparison of Data Sets')Matlab矩阵散点图绘制函数plotmatrix

共计5人评分,平均4.4分

到目前为止还没有投票~

很抱歉,这篇文章对您没有用!

让我们改善这篇文章!

告诉我们我们如何改善这篇文章?

本文来自转载,原文出处:MathWorks官网,由古哥整理发布

如若转载,请注明出处:https://iymark.com/program/matlab-data-function-plotmatrix.html



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3