Bar graph and "stacked" options.

1 回表示 (過去 30 日間)
Pietro Fiondella
Pietro Fiondella 2022 年 7 月 5 日
コメント済み: Pietro Fiondella 2022 年 7 月 5 日
I would like to obtain a bar graph with olnly some data showed as stacked.
For example consider this script.
A=[1 2 3; 2 5 3; 1 4 3];
bar (A)
I can obtain a also this type of graph with 'stacked' bars
bar(A,'stacked')
I would like to obtain a graph in wich only some data are stacked.
For example the first elements of A should appear "1" as alone bar and "2 ,3" stacked with different coulors. how can i do it?
I tryed this but it dosent work.
bar(A(1,1), A(1,2:3),'stacked')

採用された回答

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro 2022 年 7 月 5 日
This is solved easily by adding zeros in the columns that you do not want a stack, e.g.
bar ( [1 2 3;0 2 3;0 0 6]','stacked')
  1 件のコメント
Pietro Fiondella
Pietro Fiondella 2022 年 7 月 5 日
Thaks but this is not the result i am looking for.
I would like to obtain a graph with 3 group of columns eah group made by 2 clolumns,
the first group is made by: bar1=A(1,1), bar2= A(1,2)+A(1,3) and so on
the second bar3=A(2,1), bar4=A(2,2)+ A(2,3)
the third bar4=A(3,1), bar5=A(3,2)+ A(3,3)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by