Boxplot does not work
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Geoff Hayes
il 8 Nov 2014
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.)
Risposte (2)
the cyclist
il 8 Nov 2014
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
il 8 Nov 2014
Modificato: the cyclist
il 8 Nov 2014
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 Commenti
the cyclist
il 8 Nov 2014
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.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!