Plotting multiple boxplots in one figure from cell array
1 view (last 30 days)
Show older comments
I'm trying to plot some boxplots on the same figure.
My Code
d={12.9089000000000,'GA';13.3697000000000,'GA';13.4335000000000,'SA';13.5302000000000,'SA';13.8434000000000,'EP';14.2583000000000,'EP'} %snipped of data
%Create groups
EP=[];
GA=[];
PS=[];
SA=[];
SS=[];
for i=1:size(d),
if strcmp(d(i,2),'EP'),
EP(i)=cell2mat(d(i,1));
elseif strcmp(d(i,2),'GA'),
GA(i)=cell2mat(d(i));
elseif strcmp(d(i,2),'PS'),
PS(i)=cell2mat(d(i));
elseif strcmp(d(i,2),'SA'),
SA(i)=cell2mat(d(i));
elseif strcmp(d(i,2),'SS'),
SS(i)=cell2mat(d(i));
end
end
%Plot boxplots
figure(1)
x=[EP,GA,PS,SA,SS]
g={'EP','GA','PS','SA','SS'};
boxplot(x,g)
This code however does not work. Could anybody show me how to plot these boxplots on the same figure whilst having the appropriate group name (variable 'g' in the code above) on the x axis?
Thank you
0 Comments
Answers (0)
See Also
Categories
Find more on Annotations 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!