how to add lables of X axis in boxplot

3 views (last 30 days)
hi every body
i nead to plot 6 boxplots in one plot with 6 lables in x axis. i have written the code below but it has errors. could anyone hel me please
ED=[0.6647 0.6335 0.5021 0.362 0.7752 0.606 0.301 0.723 0.5946 1.2599]
Ra.E=[0.5474 0.7056 0.5004 0.5689 0.8613 0.2707 1.3853 0.5555 1.3561 0.7967]
ES=[1.2557 0.2471 1.1587 1.2546 0.3004 1.3235 1.3141 0.2728 0.4317 1.3647]
Ra.F=[1.4106 1.6141 0.1288 0.6851 0.2762 0.4164 0.2674 0.6626 0.2181 0.444]
Re.F=[0.8898 1.1365 1.0734 0.4324 1.2101 0.0305 1.2216 1.7264 1.4525 1.2577]
A.C=[1.4543 0.3838 0.965 1.2468 0.7273 0.8322 0.6808 0.9407 1.4829 0.845]
y=[ED;Ra.E;ES;Ra.F;Re.F;A.C]
boxplot(y,'Labels',{'ED','Ra.E','ES','Ra.F','Re.F','AC'})

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 8 Dec 2020
Edited: KALYAN ACHARJYA on 8 Dec 2020
Please avoid "." in the variable name, it represents the structure.
As you have defined the each data as indivisual box, it might be in column data to represent the same.
ED=[0.6647 0.6335 0.5021 0.362 0.7752 0.606 0.301 0.723 0.5946 1.2599]
RaE=[0.5474 0.7056 0.5004 0.5689 0.8613 0.2707 1.3853 0.5555 1.3561 0.7967]
ES=[1.2557 0.2471 1.1587 1.2546 0.3004 1.3235 1.3141 0.2728 0.4317 1.3647]
RaF=[1.4106 1.6141 0.1288 0.6851 0.2762 0.4164 0.2674 0.6626 0.2181 0.444]
ReF=[0.8898 1.1365 1.0734 0.4324 1.2101 0.0305 1.2216 1.7264 1.4525 1.2577]
AC=[1.4543 0.3838 0.965 1.2468 0.7273 0.8322 0.6808 0.9407 1.4829 0.845]
y=[ED',RaE',ES',RaF',ReF',AC'];
boxplot(y,'Labels',{'ED','RaE','ES','RaF','ReF','AC'})

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!