间谍
Visualize sparsity pattern of matrix
Syntax
Description
间谍(
plots the sparsity pattern of matrixS
)S
. Nonzero values are colored while zero values are white. The plot displays the number of nonzeros in the matrix,nz = nnz(S)
.
间谍(___,
specifiesMarkerSize
)MarkerSize
to give the size of the markers using either of the previous input argument combinations.
Examples
Plot Sparsity Pattern
绘制咖啡座富勒测地圆顶的连接图的60×60稀疏邻接矩阵。该基质还代表碳-60分子和足球。
B = bucky; spy(B)
Specify the color and marker.
间谍(B,' ro')
Also specify the marker size.
间谍(B,' ro',2)
Input Arguments
S
—Input matrix
matrix
Input matrix.S
is 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
MarkerSize
—Size of markers
正整数标量
Size of markers, specified as a positive integer scalar.
Example:间谍(A,3)
uses markers of size 3.
LineSpec
—Marker symbol and color
character vector|string
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 |
|
'+' |
加号 |
|
'*' |
Asterisk |
|
'.' |
观点 |
|
'x' |
叉 |
|
'_' |
Horizontal line |
|
'|' |
垂线 |
|
's' |
Square |
|
'd' |
Diamond |
|
'^' |
向上指向三角形 |
|
'v' |
Downward-pointing triangle |
|
'>' |
Right-pointing triangle |
|
'<' |
Left-pointing triangle |
|
'p' |
五角星 |
|
'h' |
Hexagram |
|
Color Name | Short Name | Appearance |
---|---|---|
' red' |
' r' |
|
'green' |
'g' |
|
'blue' |
'b' |
|
'青色' |
'c' |
|
'品红' |
'M' |
|
'yellow' |
'y' |
|
'black' |
'k' |
|
'white' |
'w' |
|
Tips
格式+
是一种基于文本的替代方案,用于显示小矩阵的非零结构:格式+眼睛(4)
ans = + + + +
Extended Capabilities
GPU Arrays
使用并行计算工具箱™在图形处理单元(GPU)上运行,加速代码。
Usage notes and limitations:
This function accepts GPU arrays, but does not run on a GPU.
For more information, seeRun MATLAB Functions on a GPU(Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
Usage notes and limitations:
This function operates on distributed arrays, but executes in the client MATLAB®.
For more information, see使用分布式阵列运行MATLAB函数(Parallel Computing Toolbox).
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América拉丁(Español)
- Canada(English)
- United States(English)
欧洲
- Belgium(English)
- 丹麦(English)
- Deutschland(德意志)
- España(Español)
- Finland(English)
- 法国(Français)
- 爱尔兰(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- 挪威(English)
- Österreich(德意志)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)