function myfillfunction(xaxisData,meanData,stdData,color1,color2) % % myfillfunction(xaxisData,meanData,stdData,color1,color2) % % plots the "meanData" versus the "xaxisData" using "color1" % A shaded area (using the fill function) is added around the mean % representing the stdData with color2. % % INPUTS % - xaxisData : vector same size as meanData & stdData % - meanData : to plot as a line % - stdData : to plot as the filled area % - (optional) color1 : color for the line (default : black) % - (optional) color2 : color for the fill (default : gray) if nargin<5 color2 = [0.7 0.7 0.7]; end if nargin<4 color1 = 'k'; end h = fill([xaxisData xaxisData(end:-1:1) xaxisData(1)],[meanData-stdData meanData(:,end:-1:1)+stdData(:,end:-1:1) meanData(1)-stdData(1)],color2); set(h,'edgecolor',color2); set(h,'facealpha',.5); % for superimposition of the plots hold on; h = plot(xaxisData,meanData); set(h,'Color',color1,'LineWidth',2); hold off; end