mysingleboxplot.m

Revision 1 - 6/13/07 at 2:37 pm by e2holmes

Back to revision history for mysingleboxplot.m
This file is part of the project Plotting routines
function mysingleboxplot(r,lowwhis,upwhis,lowbox,upbox,boxparms)

%makes one boxplot with whiskers as a specified quartile

%whiswid=.1; and boxwid=.25; are reasonable
position = boxparms.position;
whiswid = boxparms.whiswid;
boxwid = boxparms.boxwid;
boxcolor = boxparms.boxcolor;

i = position;
   botwhis=prctile(r,lowwhis);
   topwhis=prctile(r,upwhis);
   botbox=prctile(r,lowbox);
   topbox=prctile(r,upbox);
   midbox=nanmedian(r);
   plot([i-whiswid i+whiswid],[botwhis botwhis],'-k',[i-whiswid i+whiswid],[topwhis topwhis],'-k');
   hold on;
   patch([i-boxwid i+boxwid i+boxwid i-boxwid], [botbox botbox topbox topbox],boxcolor);
   plot([i-boxwid i+boxwid],[botbox botbox],'-k',[i-boxwid i+boxwid],[topbox topbox],'-k');
   plot([i-boxwid i+boxwid],[midbox midbox],'-k',[i-boxwid i+boxwid],[topbox topbox],'-k');
   plot([i i],[botwhis botbox],'-k',[i i],[topbox topwhis],'-k');
   plot([i-boxwid i-boxwid],[botbox topbox],'-k',[i+boxwid i+boxwid],[botbox topbox],'-k');
hold off;
%set(gca,'XLim',[0 n+1],'XTick',1:n)
Sculpin 0.2 | xhtml | problems or comments? | report bugs