Bar graph for two different arrays

4 ビュー (過去 30 日間)
mrituanjay kumar
mrituanjay kumar 2020 年 3 月 18 日
コメント済み: mrituanjay kumar 2020 年 3 月 25 日
I've two different arrays
a = [2 4 6 8 10]
b = [1 3 5 7 9]
now I want to plot these two array on a single bar graph where x axis values ranges from 1 to 4(1 2 3 4) and y axis contain two different bar graph side by side in different colour, it means at x axis value 1 I need two bar of values 2 & 1 similarly on at x axis value 2 I need two bar of values 4 & 3, similarly at x axis value 3 I need two bar of values 8 & 7, similarly at x axis value 4 I need two bar of values 10 & 9.

採用された回答

dpb
dpb 2020 年 3 月 18 日
Didn't read
doc bar
did you? It'll take 1:5 on the x-axis but
bar([a;b].')
  1 件のコメント
mrituanjay kumar
mrituanjay kumar 2020 年 3 月 25 日
thanks a lot....

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2012a

Community Treasure Hunt

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

Start Hunting!

Translated by