How do I group boxplots by modifying the X locations?
Ältere Kommentare anzeigen
Is there a way to set the 'X' coordinates of several boxplots?
For instance something similar to...
X = [1.2 1.8 3.2 3.8 5.2 5.8];
boxplot(X, Y)
so that it would look like groups of boxplots are set closer together?
Akzeptierte Antwort
Weitere Antworten (2)
Matt Tearle
am 18 Feb. 2011
You can cluster groups together using the 'factorgap' option. Would that do what you want?
% make some fake data
x = rand(200,1);
z = bsxfun(@plus,repmat(x,1,5),-0.1:0.1:0.3);
% standard boxplot
boxplot(z)
% make some grouping labels
g1 = repmat([1 1 1 2 2],200,1);
g2 = repmat('abcab',200,1);
% reshape everything into columns
zv = z(:);
gp1 = g1(:);
gp2 = g2(:);
% boxplot with groupings grouped!
boxplot(zv,{gp1,gp2},'factorgap',[50,0])
3 Kommentare
Paulo Silva
am 18 Feb. 2011
Is there something you can't solve with matlab? :)
Matt Tearle
am 18 Feb. 2011
Apparently:
>> worldpeace
??? Undefined function or variable 'worldpeace'.
Aamir Ansari
am 2 Aug. 2021
We can try!!
Ian
am 18 Feb. 2011
0 Stimmen
Kategorien
Mehr zu Box Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!