主要内容

间谍

Visualize sparsity pattern of matrix

Description

example

间谍(S)plots the sparsity pattern of matrixS. Nonzero values are colored while zero values are white. The plot displays the number of nonzeros in the matrix,nz = nnz(S).

example

间谍(S,LineSpec)additionally specifiesLineSpec给出标记符号和颜色以在绘图中使用。例如,间谍(A,'r*')使用非安利斯的红色星号。

example

间谍(___,MarkerSize)specifiesMarkerSizeto give the size of the markers using either of the previous input argument combinations.

Examples

collapse all

绘制咖啡座富勒测地圆顶的连接图的60×60稀疏邻接矩阵。该基质还代表碳-60分子和足球。

B = bucky; spy(B)

Figure contains an axes object. The axes object contains an object of type line.

Specify the color and marker.

间谍(B,' ro')

Figure contains an axes object. The axes object contains an object of type line.

Also specify the marker size.

间谍(B,' ro',2)

Figure contains an axes object. The axes object contains an object of type line.

Input Arguments

collapse all

Input matrix.Sis typically a sparse matrix, but can be either full or sparse.

Data Types:single|double|int8|INT16|int32|int64|uint8|uint16|uint32|uint64|logical
Complex Number Support:Yes

Size of markers, specified as a positive integer scalar.

Example:间谍(A,3)uses markers of size 3.

Marker symbol and color, specified as a character vector or string containing symbols. The symbols can appear in any order. You do not need to specify both characteristics (marker and color). For example, if you omit the color and specify the marker, then the plot uses the default colors but uses the specified markers.

Example:'or'uses red circle markers.

Marker Description Resulting Marker
'o' Circle

Sample of circle marker

'+' 加号

Sample of plus sign marker

'*' Asterisk

Sample of asterisk marker

'.' 观点

Sample of point marker

'x'

Sample of cross marker

'_' Horizontal line

Sample of horizontal line marker

'|' 垂线

Sample of vertical line marker

's' Square

方形标记样本

'd' Diamond

钻石线标记样本

'^' 向上指向三角形

Sample of upward-pointing triangle marker

'v' Downward-pointing triangle

向下指向三角标记的样本

'>' Right-pointing triangle

Sample of right-pointing triangle marker

'<' Left-pointing triangle

Sample of left-pointing triangle marker

'p' 五角星

Sample of pentagram marker

'h' Hexagram

Sample of hexagram marker

Color Name Short Name Appearance
' red' ' r'

红色样本红色

'green' 'g'

Sample of the color green

'blue' 'b'

Sample of the color blue

'青色' 'c'

Sample of the color cyan

'品红' '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

Tips

  • 格式+是一种基于文本的替代方案,用于显示小矩阵的非零结构:

    格式+眼睛(4)
    ans = + + + +

Extended Capabilities

在R2006A之前介绍