フィルターのクリア

Bar charts with categories in the x axis

4 ビュー (過去 30 日間)
Bill
Bill 2014 年 10 月 29 日
コメント済み: Star Strider 2014 年 10 月 29 日
Hi, I have data such as:
Product 1 a 15, Product 1 b 25, Product 2 a 23, Product 2 b 12, Product 2 b 6 , Product 3 a -23, Product 3 b 2,
and I want to plot a bar chart where the y axis would be the numbers and the x axis the letters where they are grouped according to their product number, how can I do this with matlab because I am struggling with the bar plotting function. Thanks.
  1 件のコメント
Star Strider
Star Strider 2014 年 10 月 29 日
What version of MATLAB are you using? Are you using a grouped bar chart? Barseries properties that were accessible before R2014b are no longer accessible in HG2.

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

回答 (1 件)

Orion
Orion 2014 年 10 月 29 日
Hi,
I'm not sure I get your problem, but I think you want something like :
% plot the data as bar
value = [15,25,23,12,-23,2];
bar(value);
ylabel('Quantity');
% change the xticklabel with characters
newXticklabel = {'1a','1b','2a','2b','3a','3b'};
set(gca,'XtickLabel',newXticklabel);
xlabel('Product');

カテゴリ

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