matlab怎么画多组箱线图?

本人用的是matlab2018,只有2020版才能用函数直接画多组箱线图,有没有别的方法可以画出来?

可以参考一下我这个例子,具体代码如下:

clear all
clc
%nums数组自己设定,这里是3列的,做三组箱线图
data1=nums(:,:,1);
data2=nums(:,:,2);
data3=nums(:,:,3);
edgecolor1=[0,0,0]; % black color
edgecolor2=[0,0,0]; % black color
edgecolor3=[0,0,0]; % black color


fillcolor1=[0, 0.45, 0.74]; % fillcolors = rand(24, 3);
fillcolor2=[0.85, 0.33, 0.10];
fillcolor3=[0.93, 0.69, 0.13];
fillcolors=[repmat(fillcolor1,5,1);repmat(fillcolor2,5,1);repmat(fillcolor3,5,1)];
position_1 = [0.8:1:4.8];  % define position for first group boxplot
position_2 = [1:1:5];  % define position for second group boxplot 
position_3 = [1.2:1:5.2];  % define position for second group boxplot 


box_1 = boxplot(data1,'positions',position_1,'colors',edgecolor1,'width',0.2,'symbol','m+','outliersize',5);
hold on;
box_2 = boxplot(data2,'positions',position_2,'colors',edgecolor2,'width',0.2,'symbol','r+','outliersize',5);
hold on;
box_3 = boxplot(data3,'positions',position_3,'colors',edgecolor3,'width',0.2,'symbol','b+','outliersize',5);
boxobj = findobj(gca,'Tag','Box');
for j=1:length(boxobj)
    patch(get(boxobj(j),'XData'),get(boxobj(j),'YData'),fillcolors(j,:),'FaceAlpha',0.5);
end
set(gca,'XTick', [1 2 3 4 5],'Xlim',[0 6]);
set(gca,'Ylim',[0 250]);
boxchi = get(gca, 'Children');
legend([boxchi(1),boxchi(6),boxchi(12)], ["fillcolor1", "fillcolor2", "fillcolor3"] );