How to overcome overlapping points without jitter or transparency in ggplot2

I am starting to use ggplot2. I have small n (about 30 or so) granular data with lots of overlap. Neither jitter, nor alpha (transparency) are suitable. Instead, the stripper with the stack and offset do everything they can, but I don't know how to do this in ggplot2. Did you know?

To see that the final result should be clicked on this figure .

Here is a script that I used several years ago.

stripchart(SystData$DayTo1Syst~SystData$strain,vertical=TRUE,method="stack",pch=19,offset=.3,xlab="Strain",main="Rapidity of Systemic Disease Onset",ylab="Days post inoculation") 
+6
r ggplot2 overlap
source share
3 answers
 # your data df <- data.frame(gp = rep(LETTERS[1:5], each =8), y = sample(1:4,40,replace=TRUE)) # calculate offsets df <- ddply(df, .(y, gp), transform, offset = (1:length(gp)-1)/20) qplot(gp, y, data=df) + stat_identity(aes(as.numeric(gp)+offset)) + theme_bw() 
+6
source share

You can use position_dodge .

 df <- data.frame(gp = rep(LETTERS[1:5], each =8), y = sample(1:4,40,replace=TRUE)) qplot(gp,y,data=df,order=y,position=position_dodge(width=0.5)) 

alt text http://img100.imageshack.us/img100/8760/dodgel.png

+8
source share

Do you want to use geom_dotplot from ggplot2

you probably want to use:

 ggplot(insert your arguments here) + geom_dotplot(binaxis = "y", stackdir = "center") 

Hope this helps. The results will look really clean, and I think you want to.

+4
source share

All Articles