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 列のスパース隣接行列をプロットします。この行列は、C60 フラーレン分子およびサッカー ボールも表現します。

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 のマーカーを使用します。

マーカーの記号および色。記号を含む文字ベクトルまたは string として指定します。記号の順番は任意です。特性 (マーカーと色) の両方を指定する必要はありません。たとえば、色を省略してマーカーを指定した場合、プロットでは既定の色と指定したマーカーが使用されます。

例: '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 より前に導入

すべて展開する