Plotting multiple box plots on same graph with same size vector?
7 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
ANKUR KUMAR
2021-4-15
编辑:ANKUR KUMAR
2021-4-15
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!