How does one overcome overlapping points without jitter or transparency in ggplot2

Farrel picture Farrel · Mar 23, 2010 · Viewed 7.3k times · Source

I am starting to use ggplot2. I have some small n (about 30 or so) granular data with lots of overlap. Neither jitter nor alpha (transparency) are suitable. Instead a stripchart with stack and offset do it best but I do not know how to do it in ggplot2. Do you know?

To see what the end result should be click on this graphic.

Here is the script I used a few 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")

Answer

Jyotirmoy Bhattacharya picture Jyotirmoy Bhattacharya · Mar 24, 2010

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