Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 删除错误图中的下标记_Matlab_Matlab Figure - Fatal编程技术网

Matlab 删除错误图中的下标记

Matlab 删除错误图中的下标记,matlab,matlab-figure,Matlab,Matlab Figure,我试图在MATLAB中绘制单边误差图。下面是示例代码和输出。我想移除红色圆圈的标记。有人能帮我吗 x = 1:10; X1=rand(13,10); y = mean(X1); U= std(X1); L=zeros(size(y)); errorbar(x,y,L,U,'--k','LineWidth',2) 没有内置的和有文档记录的方法来实现这一点。但是,您可以使用ErrorBar对象的未记录Bar属性,该对象是LineStrip对象。然后,可以删除此LineStrip对象中与条形底部对应

我试图在MATLAB中绘制单边误差图。下面是示例代码和输出。我想移除红色圆圈的标记。有人能帮我吗

x = 1:10;
X1=rand(13,10);
y = mean(X1);
U= std(X1);
L=zeros(size(y));
errorbar(x,y,L,U,'--k','LineWidth',2)

没有内置的和有文档记录的方法来实现这一点。但是,您可以使用
ErrorBar
对象的未记录
Bar
属性,该对象是
LineStrip
对象。然后,可以删除此
LineStrip
对象中与条形底部对应的顶点

% Create a normal errorbar plot
e = errorbar(x,y,L,U,'--k','LineWidth',2);

% This is needed on Windows to ensure that the VertexData property is populated
drawnow

% Remove the line strip vertices which correspond to the bottom bars
e.Bar.VertexData(:,(numel(x)*2 + 1):(numel(x) * 4)) = [];

或者,您可以使用以下命令更改上盖和下盖的宽度

% Create a normal errorbar plot
e = errorbar(x,y,L,U,'--k','LineWidth',2);

% This is needed on Windows to ensure that the VertexData property is populated
drawnow

% [lower_cap_size, upper_cap_size]
cap_sizes = [0, 0.1];

vd = e.Bar.VertexData;

% Create alternately 1's and -1's to add to multiply by the width and add
% to the bar centers
diffs = 1-mod(1:(numel(x) * 2),2)*2;

% Determine the differences relative to the center of each bar for the 
% lower and upper caps
lowers = diffs * (0.5 * cap_sizes(1));
uppers = diffs * (0.5 * cap_sizes(2));

% Replace the vertex data for the caps by adding the above differences
% to the bar centers
vd(1,(numel(x)*2 + 1):end) = repmat(vd(1,1:numel(x)*2), [1 2]) + [lowers, uppers];

% Assign the vertex data back
e.Bar.VertexData = vd;
注:此确切答案仅适用于R2014b-R2015b。在2016a,Mathworks改变了
LineStrip
的使用方式,因此
VertexData
属性的格式与上面所示的格式不同


尝试“倾覆”属性。但是它适用于所有CAP…你使用的是什么版本的MATLAB?我使用的是MATLAB R2015b谢谢,这正是我想要的,但是当我使用R2015b在我的系统中运行相同的代码时,我得到了一个错误:“矩阵索引超出了删除范围。”@Rachel你正在运行你在问题中发布的代码吗?@Rachel的
大小是多少(e.Bar.VertexData)
运行第一个命令后显示?大小(e.Bar.VertexData)ans=360@Rachel好的,什么是努美尔(x)?