-----Original Message-----
From: John Kane [mailto:jrkrideau at inbox.com]
Sent: Montag, 2. Juli 2012 15:58
To: Thaler,Thorn,LAUSANNE,Applied Mathematics
Subject: RE: [R] ggplot: dodge positions
Let's hope it makes it. Just in case my version is okay let me give
you my sessionInfo in case we have some subtle difference in settings
that is having an effect. Of course it may be the wrong graph.
sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_CA.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] RColorBrewer_1.0-5 plyr_1.7.1 reshape2_1.2.1
scales_0.2.1
[5] ggplot2_0.9.1
loaded via a namespace (and not attached):
[1] colorspace_1.1-1 dichromat_1.2-4 digest_0.5.2 labeling_0.1
[5] MASS_7.3-18 memoise_0.1 munsell_0.3 proto_0.3-9.2
[9] stringr_0.6 tools_2.15.1
John Kane
Kingston ON Canada
-----Original Message-----
From: thorn.thaler at rdls.nestle.com
Sent: Mon, 2 Jul 2012 15:53:50 +0200
To: jrkrideau at inbox.com
Subject: RE: [R] ggplot: dodge positions
Yes, that would be nice if you could send the graph directly to me.
Thanks a billion for your help and your time.
KR,
-Thorn
-----Original Message-----
From: John Kane [mailto:jrkrideau at inbox.com]
Sent: Montag, 2. Juli 2012 15:52
To: Thaler,Thorn,LAUSANNE,Applied Mathematics; r-help at r-project.org
Subject: RE: [R] ggplot: dodge positions
Damn firewalls.
However as I see the graph, the points are lined up exactly on the
centreline of each boxplot. So for example the lowest outlier on
boxplot for A is exactlly where it should be at the end of the
Real outliers for grp1 for D are exactly above the 'non-existant'
whisker for that boxplot. So I looks to me as if in my version of
the plot it is what you want.
Any change that I can email directly to you and get an attactment
through?
John Kane
Kingston ON Canada
-----Original Message-----
From: thorn.thaler at rdls.nestle.com
Sent: Mon, 2 Jul 2012 15:40:48 +0200
To: jrkrideau at inbox.com, r-help at r-project.org
Subject: RE: [R] ggplot: dodge positions
Unfortunately I can't see your example as the page is blocked by
firewall. Anyways, if I try the dodge code, the points are shifted,
they are all shifted by another offset. It makes that the green
for instance are indeed closer to the green boxplot, yet they are
not aligned meaning that all green plots seem to have a different
the x-axis, while all the green points for x == "A" should align
with "A". Am I clearer now?
KR,
-Thorn
-----Original Message-----
From: John Kane [mailto:jrkrideau at inbox.com]
Sent: Montag, 2. Juli 2012 15:21
To: Thaler,Thorn,LAUSANNE,Applied Mathematics; r-help at r-
Subject: RE: [R] ggplot: dodge positions
I don't think I was clear. Sorry. What I was refering to was the
ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() +
geom_point(aes(ymax=max(y)), position = position_dodge(width=.75))
which is giving me http://www.mediafire.com/i/?fdurpq6e6l8cu35
which was what I though you want.
I have no idea how the x axis points on the boxplot are
It may be relatively clear in the code but I don't really have the
knowledge to ferret it out.
Sorry that I cannot be of more help.
John Kane
Kingston ON Canada
-----Original Message-----
From: thorn.thaler at rdls.nestle.com
Sent: Mon, 2 Jul 2012 15:10:33 +0200
To: jrkrideau at inbox.com, r-help at r-project.org
Subject: RE: [R] ggplot: dodge positions
I guess it works with ggplot but not with ggplot2. I'm using only
latter but had a typo in my first post. So the code (which does
not
what I want) is:
library(ggplot2)
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()
Thinking of it, I would need to find out which offset ggplot uses
dodge the nested factors. If I knew the exact quantity, I could
something like
geom_point(aes(x = offset.used.by.geom_boxplot))
So how are the exact positions on the x-axis for geom_boxplot
Any ideas?
Thanks for the help, anyways.
KR,
-Thorn
-----Original Message-----
From: John Kane [mailto:jrkrideau at inbox.com]
Sent: Montag, 2. Juli 2012 15:04
To: Thaler,Thorn,LAUSANNE,Applied Mathematics; r-help at r-
Subject: RE: [R] ggplot: dodge positions
Can you expand a bit on what is wrong with the dodge option?
From
I see it looks lovely witht the points exactly lined with the
for each group but perhaps I don't understand exactly what you
John Kane
Kingston ON Canada
-----Original Message-----
From: thorn.thaler at rdls.nestle.com
Sent: Mon, 2 Jul 2012 11:43:03 +0200
To: r-help at r-project.org
Subject: [R] ggplot: dodge positions
Dear all,
I want to get a series of boxplots (grouped by two factors) and
I
overlay the original observations and the following code does
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)))
aes(x, y, colour=grp)) + geom_boxplot() +
Yet the position of the points and the position of the boxes on
x-axis is not the same. I would like that the points are
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
want to have a fixed offset for each subgroup of points such
that
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