Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

spy

可视化矩阵的稀疏模式

  • Visualization of the sparsity pattern of matrix

说明

示例

spy(S) 绘制矩阵 S 的稀疏模式。非零值是彩色,而零值是白色。该图显示矩阵中的非零元素数,nz = nnz(S)

示例

spy(S,LineSpec) 还指定 LineSpec,以给出绘图中要使用的标记符号和颜色。例如,spy(A,'r*') 使用红色星号表示非零。

示例

spy(___,MarkerSize) 指定 MarkerSize,以使用上述任一输入参数组合给出标记的大小。

示例

全部折叠

绘制 Buckminster Fuller 多面穹顶的连接图形的 60×60 稀疏邻接矩阵。此矩阵也可表示碳 60 分子和足球。

B = bucky;
spy(B)

Figure contains an axes object. The axes object with xlabel nz = 180 contains a line object which displays its values using only markers.

指定颜色和标记。

spy(B,'ro')

Figure contains an axes object. The axes object with xlabel nz = 180 contains a line object which displays its values using only markers.

还要指定标记大小。

spy(B,'ro',2)

Figure contains an axes object. The axes object with xlabel nz = 180 contains a line object which displays its values using only markers.

输入参数

全部折叠

输入矩阵。S 通常是稀疏矩阵,但也可以是满矩阵或稀疏矩阵。

数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical
复数支持:

标记的大小,指定为正整数标量。

示例: spy(A,3) 使用大小为 3 的标记。

标记符号和颜色,指定为包含符号的字符向量或字符串。符号可以按任意顺序显示。您不需要同时指定两种特征(标记和颜色)。例如,如果忽略颜色而只指定标记,则绘图使用默认颜色,但使用指定的标记。

示例: 'or' 使用红色圆形标记。

标记描述生成的标记
"o"圆圈

Sample of circle marker

"+"加号

Sample of plus sign marker

"*"星号

Sample of asterisk marker

"."

Sample of point marker

"x"叉号

Sample of cross marker

"_"水平线条

Sample of horizontal line marker

"|"垂直线条

Sample of vertical line marker

"square"方形

Sample of square marker

"diamond"菱形

Sample of diamond marker

"^"上三角

Sample of upward-pointing triangle marker

"v"下三角

Sample of downward-pointing triangle marker

">"右三角

Sample of right-pointing triangle marker

"<"左三角

Sample of left-pointing triangle marker

"pentagram"五角形

Sample of pentagram marker

"hexagram"六角形

Sample of hexagram marker

颜色名称短名称外观
'red''r'

Sample of the color red

'green''g'

Sample of the color green

'blue''b'

Sample of the color blue

'cyan' 'c'

Sample of the color cyan

'magenta''m'

Sample of the color magenta

'yellow''y'

Sample of the color yellow

'black''k'

Sample of the color black

'white''w'

Sample of the color white

提示

  • format + 是显示小矩阵的非零结构体的基于文本的替代方法:

    format +
    eye(4)
    ans =
    
    +   
     +  
      + 
       +

扩展功能

版本历史记录

在 R2006a 之前推出

全部展开