How to make nonumeric x-axis values for Bar Charts

133 ビュー (過去 30 日間)
tarmizi adam
tarmizi adam 2013 年 1 月 26 日
Hello all,
I want to use the MATLAB bar plot to plot some data. I have these data that i've imported from excel (4 Rows and 2 columns).
40 Feat = 50.52 60 Feat = 36.60 90 Feat = 46.78 120 Feat = 32.56
How do i plot a bar graph with the x-axis labeled as '40 Feat','60 Feat', '90 Feat' and so on...
I have done this, but the x-axis does not display what i intend to do. The x-axis shows nothing
%read excel data to plot
[numDat,txtDat]=xlsread('BarPlot.xlsx');
x = numDat(:,1);
y = txtDat(:,1);
bar(x);
set(gca,'xtick',1:9,'xticklabel',y);

回答 (1 件)

Wayne King
Wayne King 2013 年 1 月 26 日
Y = [50.52 36.60 46.78 32.56];
bar(Y)
set(gca,'xticklabel',{'40 feet','60 feet','120 feet'})

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by