Matlab箱图 [英] Matlab Boxplots

查看:112
本文介绍了Matlab箱图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个准箱形图,如所附报告的第15/16页所示.

I'd like to create a quasi boxplot graph as shown on pages 15/16 of the attached report.

comisef.eu/files/wps031.pdf

comisef.eu/files/wps031.pdf

理想情况下,我只想显示报告中的中位数,最大值和最小值.

Ideally I only want to show the median, the maximum and minimum values as in the report.

我也希望与报告中显示的间距相似.

I would also like to have similar spacing to that shown in the report.

目前,我有两个矩阵,其中存储了所有必需的值,但不知道如何在matlab中执行此操作.

Currently I have two matrices with the all the necessary values stored in them but have no idea how to do this in matlab.

boxplot函数提供的数据过多(离群值等),使得生成的图看起来很混乱,尤其是当我尝试像原始报告中那样在一页上绘制200时.

The boxplot function gives too much data (outliers etc) which makes the resulting graph look confused especially when I try to plot 200 on one page as in the original report.

还有另一个功能可以与matlab报表中的功能相同吗?

Is there another function that can so the same thing as in the report in matlab?

巴兹

好的,这里是一些测试数据,每行代表一个数据集的10组估计值,每列代表给定观察值的测试编号.

OK here is some test data each row represents 10 sets of estimations of a data set, and each column represents the test number for a given observation.

当箱线图在输入矩阵的列上工作时,您将需要对矩阵进行转置.

As boxplot works on the columns of the input matrix you will need to transpose the matrix.

是否可以关闭离群值和四分位间距?理想情况下,我只想查看最大值,最小值和中位数?

Is it possible to turn outliers and the inter-quartile ranges off? Ideally I just want to see the maximum, minimum and median values?

您可以重复以下数据以获取最多200个数据.或者如有必要,我可以发送更多数据.

You can repeat the data below to get up to 200. Or I can send more data if necessary.

0.00160329732202511 0.000859407819412016    0.000859407819411159      0.0659939338995606    0.000859407819416322    0.000859407819416519    2.56395024851142e-15    2.05410662537078e-14    0.000859407819416209
1.67023155116586e-06    8.88178419700125e-16    1.67023155115637e-06    0.000730536218639616    1.67023155105582e-06    3.28746017489609e-15    4.41416632660789e-15    1.67023155094400e-06    1.67023155097567e-06
1.42410590843629e-06    1.42410590840224e-06    1.76149166727218e-15    5.97790925044131e-15    1.42410590843863e-06    2.87802701599909e-15    9.31529385335274e-16    9.17306727455842e-16    0.000820358763518906
8.26849110292527e-16    3.23505095414772e-15    4.38139485761850e-07    4.38139485938112e-07    4.38139485981887e-07    0.000884647755317917    3.72611754134110e-15    4.38139485974329e-07    4.38139485923219e-07
0.000160661751819407    0.000870787937135265    0.000870787937136209    1.16934122581182e-15    9.02860049358913e-16    1.18053134896556e-15    1.40433338743068e-15    0.000870787937135929    1.13510916297112e-15
1.16934122581182e-15    3.80292342262841e-05    3.80292342263200e-05    0.00284904319356532 1.74649997619656e-15    3.80292342264024e-05    0.00284904319356537 1.01267920724547e-15    0.00284904319356540
   0.100091800399985    0.100091773169254   0.100091803903140   0.000770464183529358    0.100091812455930   3.49996706323281e-05    3.49996706323553e-05    1.05090687851466e-15    0.100091846333800
0.00100555294602561 0.00100555294601056 0.105365907420183   0.000121078082591672    9.02860049358913e-16    0.000121078082591805    4.49679158258033e-15    7.77684615168284e-16    0.000121078082591693
0.122539456858702   0.000363547764643498    0.000363547764643509    0.122516928568610   0.0101487499394213  0.122408366511784   0.000363547764643519    1.13510916297112e-15    0.122521393586646
0.000460749357561036    0.000460749357560646    3.27600489447913e-13    1.18053134896556e-15    0.000460749357561239    1.54689304063675e-15    0.000460749357560827    0.000460749357561205    1.16934122581182e-15

推荐答案

我建议不要使用箱线图,而要绘制从最小值到最大值的线,并在中位数处做一个标记. Boxplot绘制从25%到75%的框,这听起来并不像您想要的.像这样:

Instead of using boxplot, I suggest just drawing lines from the min to the max and making a mark at the median. Boxplot draws boxes from the 25 to 75 percentile, which doesn't sound like what you want. Something like this:

% fake data
nPoints = 100;
data = 10*rand(10, nPoints);

% find statistics
minData = min(data, [], 1);
maxData = max(data, [], 1);
medData = median(data);

% x coordinates of each line. Change this to change the spacing.
x = 1:nPoints;

figure
hold on

%plot lines
line([x; x], [minData; maxData])
% plot cross at median
plot(x, medData, '+')

要具有水平线和第二条轴,您可以执行以下操作:

To have horizontal lines and a second axis you can do something like this:

figure
h1 = subplot(1,2,1);
h2 = subplot(1,2,2);

% left subplot
axes(h1)
hold on
%plot lines
line([minData; maxData], [x; x])

% plot cross at median
plot(medData, x, '+')

% link the axes so they will have the same limits
linkaxes([h1,h2],'y')
% turn off ticks on y axis.
set(h2, 'YTick', [])

这篇关于Matlab箱图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆