Can you expand a bit on what is wrong with the dodge option?  From what I see 
it looks lovely witht the points exactly lined with the boxplots for each group 
but perhaps I don't understand exactly what you want .



John Kane
Kingston ON Canada


> -----Original Message-----
> From: thorn.tha...@rdls.nestle.com
> Sent: Mon, 2 Jul 2012 11:43:03 +0200
> To: r-help@r-project.org
> Subject: [R] ggplot: dodge positions
> 
> Dear all,
> 
> I want to get a series of boxplots (grouped by two factors) and I want to
> overlay the original observations and the following code does almost what
> I want:
> 
> library(ggplot)
> ddf <- data.frame(x=factor(rep(LETTERS[1:4], each=30)), y =
> runif(120,0,10), grp = factor(rep(rep(1:3, 10), 4)))
> ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() + geom_point()
> 
> Yet the position of the points and the position of the boxes on the
> x-axis is not the same. I would like that the points are shifted
> accordingly, such that they line up with the boxplots. I tried
> position_dodge:
> 
> ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() +
> geom_point(aes(ymax=max(y)), position = position_dodge(width=.75))
> 
> but that did not really help, as all points are now dodged and I just
> want to have a fixed offset for each subgroup of points such that the
> boxplot and the points are aligned. Any ideas?
> 
> 
> Kind Regards,
> 
> Thorn Thaler
> Mathematician
> 
> Applied Mathematics
> Nestec Ltd,
> Nestlé Research Center
> PO Box 44
> CH-1000 Lausanne 26
> Phone: +41 21 785 8220
> Fax: +41 21 785 9486

____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at 
http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most 
webmails

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to