On 07/28/2011 01:48 PM, sf wrote:
> Hi,
>
> I needed more fine control for overdrawing of dots, so I wrote a
> position_stacking routine. It essentially permits to horizontally or
> vertically stack points instead of overwriting them.
>
> Any comments on it? I'm sure that the core of the routine could be
> sped up.
>
> Sebastian
This sounds like something I've wanted for a while.
There was originally something sort of special-purpose here
http://biostat.mc.vanderbilt.edu/wiki/Main/TatsukiRcode but it appears
to do something a little different -- "jitter if necessary".
If/when I get a chance to try it I will see if I can think of ways to
streamline the guts. duplicated() is a good way to identify duplicated
points in a data frame ...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEUEARECAAYFAk4xpi8ACgkQc5UpGjwzenOTigCWONnS+gEGQhUg8ZvokoTgFfiZ
YgCgkwI1ypOTYn0qvBtzEgjo/IAmC4I=
=BlTr
-----END PGP SIGNATURE-----
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
Dennis
We use beeswarm() with do.plot=F to get the nudged values for numerically-assigned groups (factors); YMMV.
express <- data.frame(strain, as.numeric(intensity), leptin)
colnames(express)[2:3] <- c("Intensity", "fac")
express <- express[order(strain, leptin),]
express <- within(express, fac <- factor(fac, levels=unique(express$fac), ordered=is.ordered(fac)))
express <- data.frame(express, as.numeric(express$fac))
colnames(express)[4] <- "facN"
signal <- beeswarm(Intensity ~ facN, data=express, method="smile", spacing=8, do.plot=F)[,c(1,2,6)]
colnames(signal) <- c("Leptin", "Intensity", "facN")
expression <- merge(express, signal)
p <- ggplot(expression, aes(Leptin, Intensity, colour=strain, label=strain)) + geom_text() +
facet_grid(. ~ fac, scales="free_x", space="free") +
scale_x_continuous(breaks=c(1:2), labels=c("MinusLeptin","PlusLeptin"), expand=c(0, 0.5)) +
opts(legend.position = "none")