Skip to content

Instantly share code, notes, and snippets.

@VijayKrishna
Created March 17, 2013 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VijayKrishna/5180287 to your computer and use it in GitHub Desktop.
Save VijayKrishna/5180287 to your computer and use it in GitHub Desktop.
Plotting Box-plots in Groups for Vectors of Varying Lengths
x = [1,2,3,4,5,1,2,3,4,6];
group = [1,1,2,2,2,3,3,3,4,4];
positions = [1 1.25 2 2.25];
boxplot(x,group, 'positions', positions);
color = ['y', 'y', 'c', 'c'];
h = findobj(gca,'Tag','Box');
for j=1:length(h)
patch(get(h(j),'XData'),get(h(j),'YData'),color(j),'FaceAlpha',.5);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment