積み上げ棒グラフの色を変える方法

17 vues (au cours des 30 derniers jours)
qrqr
qrqr le 18 Mar 2020
Modifié(e) : Jiro Doke le 19 Mar 2020
以下の積み上げ棒グラフがあります。
A=[1 2 3; 4 5 6;5 8 9];
bar(A,"stacked");
このグラフの色を変更したいのですが、どのようにするのでしょうか?
下から赤、青、黒 で色を変えたいと思っています。
よろしくお願いします。

Réponse acceptée

michio
michio le 18 Mar 2020
Modifié(e) : michio le 18 Mar 2020
それぞれ別々の bar オブジェクトが作られるので・・ひとまず以下のようにすれば色を変えることができます。
A=[1 2 3; 4 5 6;5 8 9];
h_bar = bar(A,"stacked");
h_bar(1).FaceColor = 'red';
h_bar(2).FaceColor = 'blue';
h_bar(3).FaceColor = 'black';
  1 commentaire
qrqr
qrqr le 18 Mar 2020
ありがとうございます。

Connectez-vous pour commenter.

Plus de réponses (1)

Jiro Doke
Jiro Doke le 18 Mar 2020
Modifié(e) : Jiro Doke le 19 Mar 2020
棒グラフ(bar)のオブジェクトをいじると、色などを変更することができます。
A=[1 2 3; 4 5 6;5 8 9];
b = bar(A,"stacked");
b(1).FaceColor = "r";
b(2).FaceColor = "b";
b(3).FaceColor = "k";
  3 commentaires
qrqr
qrqr le 18 Mar 2020
ありがとうございます。
Jiro Doke
Jiro Doke le 18 Mar 2020
失礼しました。(笑)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Networks dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!