Two Bar Plots on one graph, with the bars next to each other, not on top of.

5 ビュー (過去 30 日間)
Tim Mottram
Tim Mottram 2012 年 10 月 24 日
コメント済み: MichaelO 2020 年 8 月 26 日
Hi guys,
As the title suggests I want to make a bar graph. I have 2 histograms and the values for xOut are the same. If I try to use hold on, or in fact plotYY, the bars are plotted directly over the top of each other. What I want is a bar plot where the bars for each bin are next to each other, and it would be nice to have them in a different colour. :)
Thanks in advance.
Tim

採用された回答

Sean de Wolski
Sean de Wolski 2012 年 10 月 24 日
bar([1 2],[pi exp(1);1 4])
  5 件のコメント
VBBV
VBBV 2018 年 6 月 28 日
I have similar problem ... if I want to display the x-axis with text instead of 1 and 2 ... lets say subjects, airlines etc
MichaelO
MichaelO 2020 年 8 月 26 日
xticks([1:2])
xticklabels({'first column', 'second column'})

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

その他の回答 (1 件)

Gessica Cos
Gessica Cos 2018 年 7 月 2 日
Hi everyone, I have the same problem as Tim. I did not understand how to draw two bar charts on a single chart, with the bars side by side. If i have two vector:
a=[3 5 8 2]; b=[5 2 6 4 7];
How can I get something like this at the attached file?

カテゴリ

Help Center および File ExchangeBar Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by