I am trying to plot a bar chart like this: x = [9,10,11,12,13,14] x1 = [1,2,3,4,5,6] y = [2,4,5,6,7,8] y1 = [3,2,4,5,6,9] h = bar(x,y,'red') hold on h = bar(x1,y1,'blue')
What I get as a result is the picture I show. Why are there labels missing in x? The labels that are missing are always the ones after the hold on. Any ideas?

 採用された回答

Stephan
Stephan 2018 年 7 月 20 日
編集済み: Stephan 2018 年 7 月 20 日

0 投票

Hi,
x = [9,10,11,12,13,14];
x1 = [1,2,3,4,5,6];
y = [2,4,5,6,7,8];
y1 = [3,2,4,5,6,9];
h = bar([x x1],[y y1]);
h.FaceColor = 'flat';
for k = 7:12
h.CData(k,:) = [1 0 0];
end
Best regards
Stephan

その他の回答 (1 件)

Alex Apostolou
Alex Apostolou 2018 年 7 月 20 日

0 投票

Perfect, thanks!!

1 件のコメント

Stephan
Stephan 2018 年 7 月 20 日
Please accept helpful answers in order to help people with similar problems finding helpful answers.
Best regards
Stephan

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

カテゴリ

質問済み:

2018 年 7 月 20 日

コメント済み:

2018 年 7 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by