How to make nonumeric x-axis values for Bar Charts

144 views (last 30 days)
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);

Answers (1)

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

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!