Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Boxplot several datasets
Replies: 3   Last Post: Nov 20, 2012 3:19 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Tom Lane

Posts: 854
Registered: 12/7/04
Re: Boxplot several datasets
Posted: Nov 19, 2012 11:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> I would like to plot several boxplots in the same figure for different
> datasets. For example:

...
> I also would like to have the boxes in different colours or shapes. Is
> this possible?


There are many related options in the boxplot function. Type "help boxplot",
and try this to get you started:

x1 = rand(20,6);
x2 = .5+rand(20,6);
x3 = randn(20,6);

x = [x1;x2;x3]; x = x(:);
g1 = [ones(size(x1)); 2*ones(size(x2)); 3*ones(size(x3))]; g1 = g1(:);
g2 = repmat(1:6,60,1); g2 = g2(:);

boxplot(x, {g2,g1}, 'colorgroup',g1, 'factorgap',5, 'factorseparator',1)

-- Tom





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.