Skip to content
Prev 285896 / 398503 Next

overlay of two sets of boxplots

Hello John,
Thanks for your fast answer. I will try to be clearer and more detailed this time. At the moment I am importing a dataframe like below as a '.csv file'. I want to generate a boxplot for M and F values grouped by X whereby boxplots for M and F should be above or very close to each other.  Please see attachment for example figure. Till now I have tried a code that looks like the one below the frame (I found it in the graph help of R for boxes close to each other):

X	M	                 F
Exp1	-90.0273224	-77.66531714
Exp1	-73.33333333	-96.36363636
Exp1	-98.24561404	-91.57848325
Exp1	-65.2173913	-59.18367347
Exp1	-98.7654321	-92.42424242
Exp1	-96.42857143	-89.25925926
Exp2	-84.61538462     -47.36842105
Exp2	-43.63636364     -22.37762238
Exp2	-47.5	               -33.33333333
Exp2	-55.49450549	-66.66666667
formula = F~Strain,
    data    = pain,
    boxwex  = 0.25,
    at      = 1:38 - 0.1,
    subset  =supp== "F",
    col     = "red",
    xlab    = "Strain",
    ylab    = " F"
   			 )
boxplot(
    formula = M~Strain,
    data    = pain,
    boxwex  = 0.25,
    at      = 1:38 + 0.1,
    subset  =supp== "M",
    col     = "orange",
    add     = TRUE )

...but I did cannot find anywhere what supp means and R cannot read it. 
I hope this is explained ok. Any kind of answer would help!
Best
Mirjam

-----Original Message-----
From: John Kane [mailto:jrkrideau at inbox.com] 
Sent: Monday, February 20, 2012 6:00 PM
To: Mirjam Appel; r-help at r-project.org
Subject: RE: [R] overlay of two sets of boxplots

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

At a rough guess you may want to have a look at the mfrow in ?par  but without some sample data and a bit more information about what you need it is difficult to suggest more.

By the way dput (see ?dput) is a handy way to supply a sample data set here.

John Kane
Kingston ON Canada
____________________________________________________________
Receive Notifications of Incoming Messages Easily monitor multiple email accounts & access them with a click.
Visit http://www.inbox.com/notifier and check it out!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: overlayed boxplots.pdf
Type: application/pdf
Size: 9952 bytes
Desc: overlayed boxplots.pdf
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120220/9db85ae4/attachment.pdf>