%This program can  draw error line 
%Author:    Zhengwei Yuan
%           National Institute of Biological Sciences (NIBS), Beijing 102206, China
%           yuanzhengwei@nibs.ac.cn
function drawErrorLine(x,y,error,color,facealpha,fig)
% x = x;
% y = y;
% error = error;

x1 = x;
x2 = fliplr(x);

y1 = y - error;
y2 = fliplr(y + error);


% figure(fig);

%20170617_change color definition
% patch([x1 x2],[y1 y2],facecolor,'EdgeColor','none','FaceAlpha',facealpha);
% hold on;
% facecolor = facecolor==1;
% facecolor = double(facecolor);
facecolor = color*0.3+0.7;
patch([x1 x2],[y1 y2],facecolor,'EdgeColor','none','FaceAlpha',facealpha);

hold on

plot(x,y,'color',color,'LineWidth',2);