-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathScatterError.m
More file actions
29 lines (25 loc) · 874 Bytes
/
ScatterError.m
File metadata and controls
29 lines (25 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function h = ScatterError(mx,dx,my,dy,varargin)
% ScatterError makes a scatterplot with errorbars
%
% 20160213 / 20160724
p = inputParser;
% addParameter(p,'markerOptions',{'linewidth',1,'markersize',5},@iscell);
addParameter(p,'markerOptions',{10,[0 0 1],'markerfacecolor',[0 0 1]},@iscell);
addParameter(p,'errbarOptions',{'linewidth',0.5,'color',[.5 .5 .5]},@iscell);
parse(p,varargin{:});
markerOptions = p.Results.markerOptions;
errbarOptions = p.Results.errbarOptions;
% plot(mx,my,'o',markerOptions{:});
h=scatter(mx,my,markerOptions{:});
hold all
col = [.5 .5 .5];
for idx = 1:length(mx)
if ~isempty(dy)
plot(mx([idx idx]), my(idx) + [-1 1].*dy(idx),...
'-', 'color', col,errbarOptions{:});
end
if ~isempty(dx)
plot(mx(idx) + [-1 1].*dx(idx), my([idx idx]),...
'-', 'color', col,errbarOptions{:});
end
end