plot 2d matrix

3 ビュー (過去 30 日間)
BENEDETTA CECCONI
BENEDETTA CECCONI 2021 年 6 月 11 日
コメント済み: SALAH ALRABEEI 2021 年 6 月 12 日
Hello,
I have a 8x10 matrix. 10 are the number of subjects and 8 the number of different ranges of values I have. I only have values of 1 or 0. I'd like to plot on the y-axis the 8 ranges and the x-axis the 10 subjects: i.e. i want to draw one bar for each subject, divided in 8 parts (in correspondance to the 8 ranges on the y-axis) and color these 8 segments black when it is 0 and white when it is 1. I attached a picture of the graph I drew by hand..
does anyone have any idea how i could do this?
Thanks in advance

回答 (1 件)

SALAH ALRABEEI
SALAH ALRABEEI 2021 年 6 月 11 日
Assume u matrix is A
%
bar(A','stacked')
  2 件のコメント
BENEDETTA CECCONI
BENEDETTA CECCONI 2021 年 6 月 11 日
thanks for your answer but I had already tried this but unfortunately you just get three bars in correspondance to the 1 and you have the 8 values on the x axis and from 0 to 1 on the y axis..Any other ideas?
SALAH ALRABEEI
SALAH ALRABEEI 2021 年 6 月 12 日
If I get u correctly, u need to represent each col by a bar, then each bar is divided into six sections.
If this what u need, try to transpse the matrix

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by