Plotting multiple box plots on same graph with same size vector?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Matthew Peoples
el 15 de Abr. de 2021
Editada: ANKUR KUMAR
el 15 de Abr. de 2021
Hi everyone!
I've run into a strange issue. I have 5 1x60 double arrays that I am trying to plot boxplots of (5 boxplots on the same graph).
num_non_grey_pix_each_cat %1×5 cell array - each cell is 1x60
vects = [cell2mat(num_non_grey_pix_each_cat{1})]; % I tried just trying to plot 2
vects2 =[cell2mat(num_non_grey_pix_each_cat{2})];
vects = [vects; vects2];
figure;
boxplot(vects);
Trying to plot one plot works out fine, but then adding the second creates 60 boxplots? I'm very confused - i basically want five of the first plot on the one graph. Thank you so much!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/584881/image.png)
0 comentarios
Respuesta aceptada
ANKUR KUMAR
el 15 de Abr. de 2021
Editada: ANKUR KUMAR
el 15 de Abr. de 2021
As you have not provided the exact data, I am generating just the random data.
col=@(x)reshape(x,numel(x),1);
boxplot2=@(C,varargin)boxplot(cell2mat(cellfun(col,col(C),'uni',0)),...
cell2mat(arrayfun(@(I)I*ones(numel(C{I}),1),col(1:numel(C)),'uni',0)),varargin{:});
A={randi(25,1,100),randi(25,1,60),randi(25,1,60),randi(25,1,60),randi(25,1,60)}
boxplot2(A)
Reference:
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!