Effacer les filtres
Effacer les filtres

How to make nonumeric x-axis values for Bar Charts

95 vues (au cours des 30 derniers jours)
tarmizi adam
tarmizi adam le 26 Jan 2013
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);

Réponses (1)

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

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by