Boxplot does not work
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello All, I wanted to use boxplot in matlab. But I got those errors.
Error using boxplot>assignUserLabels (line 1660)
Points with more than one value of the 'labels' parameter are in the same group.
Error in boxplot>identifyGroups (line 1225)
[userLabelsByGroup,numUserLabelVars,skipLabelGrouporderScramble] = ...
Error in boxplot (line 286)
[groupIndexByPoint,groupVisibleByPoint,labelIndexByGroup,gLevelsByGroup,...
Error in Boxplottrial (line 14)
boxplot(values, 'Label', {'A', 'B', 'C','D','F','G','H','I','J','K'})
Here is the matlab code I used.... Any help please,
cm1S1=19.2093;
cm1=16.9359;
cm2=14.3030;
cm3=14.6428;
cm4=16.2188;
cm5=16.6686;
cm6=17.2386;
cm7=17.1935;
cm8=16.9363;
cm9=16.3418;
values=[cm1S1;cm1;cm2;cm3;cm4;cm5;cm6;cm7;cm8;cm9];
figure
boxplot(values, 'Label', {'A', 'B', 'C','D','F','G','H','I','J','K'})
댓글 수: 1
Geoff Hayes
2014년 11월 8일
Abinet - what are you attempting to show with the labels? Since your values is a column vector, I think only one box plot should appear on the figure (see boxplot, if X is a vector, there is just one box.)
답변 (2개)
the cyclist
2014년 11월 8일
This code will work, because you are plotting just one distribution, and there is one label:
cm1S1=19.2093;
cm1=16.9359;
cm2=14.3030;
cm3=14.6428;
cm4=16.2188;
cm5=16.6686;
cm6=17.2386;
cm7=17.1935;
cm8=16.9363;
cm9=16.3418;
values=[cm1S1;cm1;cm2;cm3;cm4;cm5;cm6;cm7;cm8;cm9];
figure
boxplot(values, 'Label', {'A'})
the cyclist
2014년 11월 8일
편집: the cyclist
2014년 11월 8일
This is a different guess at what you mean.
cm1S1=19.2093; cm1=16.9359; cm2=14.3030; cm3=14.6428; cm4=16.2188; cm5=16.6686; cm6=17.2386; cm7=17.1935; cm8=16.9363; cm9=16.3418; values=[cm1S1;cm1;cm2;cm3;cm4;cm5;cm6;cm7;cm8;cm9];
numberValues = numel(values);
label = {'A', 'B', 'C','D','F','G','H','I','J','K'};
figure
hold on
boxplot(values)
plot(1,values,'r*')
for nv = 1:numberValues
text(1.1,values(nv),label(nv))
end
댓글 수: 2
the cyclist
2014년 11월 8일
In your original question, you showed just one vector of data. Now you have three different matrices, each of a different size. That is very different. It is not at all clear what sets of data belong in the same distribution with each other, and what you are trying to label.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!