2013-11-26 25 views
0

我想创建一个像15/16页一个情节:如何绘制asymnmetric错误与errorbar

comisef.eu/files/wps031.pdf

下面的例子靠拢,但只允许对称误差条:

http://www.mathworks.com/matlabcentral/fileexchange/35294-matlab-plot-gallery-errorbar-plot/content/html/Errorbar_Plot.html

本例具有非对称errorbars但只有当针对条形图绘制值 bar with asymmetric error bounds in Matlab

是否可以像第一个示例中显示的不对称错误条,但不需要条形图?

感谢巴兹

我也有一个问题,我尽量做到与箱线图同样的事情,但我不知道它(如果确实其中任何可以)可以做到这一点。

Matlab Boxplots

x = 1985:.05:2001; % x data 
grad_ = rand(1,length(x))*.3; % graduated stuff 
grad_2 = rand(1,length(x))*.3; 
grad_3= rand(1,length(x))*.3; 
h = subplot(1,3,1); 

errorbar(grad_,x,grad_2,grad_3,'o'); 
axis(h, [0 0.6 1985 2001]) 
set(h, 'Ytick', x(1):x(end), 'Xtick', 0:.15:.6, 'YDir','reverse', 'YGrid', 'on'); 
xlabel('Gradient Search') 

回答

3

MATLAB函数errorbar可以创建一个非对称误差棒,并且不需要的条形图。

close all 
x = 1:3; 
y = [4 6 3]; 
lower = [1 4.5 0]; 
upper = [4.2 2 4]; 

errorbar(x, y, lower, upper, 'o') 

enter image description here

1

这就是我想出了:

x = 1985:.05:2001; % x data 
grad_ = rand(1,length(x))*.3; % graduated stuff 
h = subplot(1,3,1); 
plot(grad_,x); % flip x and y for vertical plot 
axis(h, [0 0.6 1985 2001]) 
set(h, 'Ytick', x(1):x(end), 'Xtick', 0:.15:.6, 'YDir','reverse', 'YGrid', 'on'); 
xlabel('Gradient Search') 

diff_ = rand(1,length(x)).^2 *.15; % differential stuff 
h = subplot(1,3,2); 
plot(diff_,x); 
set(h,'yticklabel',[], 'Ytick', x(1):x(end), 'Xtick', 0:.15:.6, 'YDir','reverse', 'YGrid', 'on'); 
axis(h, [0 0.6 1985 2001]) 
xlabel('Differential Evolution') 

delta_ = rand(1,length(x)).^2 *.2 - .2; % delta stuff 
h = subplot(1,3,3); 
plot(delta_,x); 
set(h,'yticklabel',[], 'Ytick', [], 'Xtick', -.15:.15:.15, 'YDir','reverse', 'XGrid', 'on'); 
axis(h, [-.15 .15 1985 2001]) 
xlabel('\Delta of medians') 
+0

首先非常感谢你!在这种情况下,你们都应该得到信用!有可能把上面显示的错误图表放到你的框架中吗?这将是完美的解决方案。 – Bazman

+0

确定了(我的编辑问题中的代码)非常复杂,但不幸的是错误条出现在垂直方向上是否可以旋转它们? – Bazman

+0

是的,我正在研究,我不这么认为。如果不使用[fileexchange](http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=3963&objectType=FILE)中的自定义函数, – athypes