how to plot (0 1) matrix on figure

9 ビュー (過去 30 日間)
UWM
UWM 2025 年 2 月 28 日
コメント済み: Star Strider 2025 年 2 月 28 日
I have a big matrix with 0 and 1:
0 0 0 1 0 1 0 ...
0 0 0 1 0 1 0 ...
1 0 0 1 0 0 1 ...
...
I want to crate a dot plot where axis x wil be the number of columns, axis y will be the number of rows. Dots in line x=1 should apper if in first column vale=1 and not if value =0; dots in line x=2 should apper if in second column vale=1 and not if value=0; etc...
Thanks in advance for help
  2 件のコメント
Stephen23
Stephen23 2025 年 2 月 28 日
M = [0,0,0,1,0,1,0; 0,0,0,1,0,1,0; 1,0,0,1,0,0,1]
M = 3×7
0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 0 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
imagesc(M)
UWM
UWM 2025 年 2 月 28 日
Thank you! It also works perfect!

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2025 年 2 月 28 日
I am not certain what you intend by ‘dot plot’, however the spy function exists to do just that, if you only want to depict the elements —
M = [0 0 0 1 0 1 0
0 0 0 1 0 1 0
1 0 0 1 0 0 1];
figure
spy(M)
.
  2 件のコメント
UWM
UWM 2025 年 2 月 28 日
Thank you for help!
Star Strider
Star Strider 2025 年 2 月 28 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by