Matlab中有关boxplot(X)命令的解释:
boxplot(X) produces a box and whisker plot for each column of the matrix X. The box has lines at the lower quartile, median, and upper quartile values. Whiskers extend from each end of the box to the adjacent values in the data—by default, the most extreme values within 1.5 times the interquartile range from the ends of the box. Outliers are data with values beyond the ends of the whiskers. Outliers are displayed with a red + sign.
格式 boxplot(X) %产生矩阵X的每一列的盒图和“须”图,“须”是从盒的尾部延伸出来,并表示盒外数据长度的线,如果“须”的外面没有数据,则在“须”的底部有一个点。
boxplot(X,notch) %当notch=1时,产生一凹盒图,notch=0时产生一矩箱图。
boxplot(X,notch,'sym') %sym表示图形符号,默认值为“+”。
boxplot(X,notch,'sym',vert) %当vert=0时,生成水平盒图,vert=1时,生成竖直盒图(默认值vert=1)。
boxplot(X,notch,'sym',vert,whis) %whis定义“须”图的长度,默认值为1.5,若whis=0则boxplot函数通过绘制sym符号图来显示盒外的所有数据值。
Examples 1
The following commands create a box plot of car mileage grouped by country.
load carsmall
boxplot(MPG,Origin)
Examples 2
The following example produces notched box plots for two groups of sample data.
x1 = normrnd(5,1,100,1);
x2 = normrnd(6,1,100,1);
boxplot([x1,x2],'notch','on')
Examples 3
x1 = normrnd(5,1,100,1);
x2 = normrnd(6,1,100,1);
boxplot([x1,x2])
The difference between the medians of the two groups is approximately 1.Since the notches in the boxplot do not overlap, you can conclude, with 95% confidence, that the true medians do differ.
Examples 4
The following figure shows the boxplot for same data with the length of the whiskers specified as 1.0 times the interquartile range. Points beyond the whiskers are displayed using +.
x1 = normrnd(5,1,100,1); x2 = normrnd(6,1,100,1); boxplot([x1,x2],'notch','on','whisker',1)