I am trying to graphically evaluate the distribution (bimodal or unimodal) of data sets in which the number of data points in a data set can vary widely. My problem is to indicate the number of data points using something like skate plots, but to avoid the problem with a series with many data points, throw a series on just a few points.
I am currently working in ggplot2 , combining geom_density and geom_rug as follows:
# Set up data: 1000 bimodal "b" points; 20 unimodal "a" points set.seed(0); require(ggplot2) x <- c(rnorm(500, mean=10, sd=1), rnorm(500, mean=5, sd=1), rnorm(20, mean=7, sd=1)) l <- c(rep("b", 1000), rep("a", 20)) d <- data.frame(x=x, l=l) ggplot(d, aes(x=x, colour=l)) + geom_density() + geom_rug()

It almost does what I want, but points "a" are overloaded with points "b".
I cracked the solution using geom_point instead of geom_rug :
d$ypos <- NA d$ypos[d$l=="b"] <- 0 d$ypos[d$l=="a"] <- 0.01 ggplot() + geom_density(data=d, aes(x=x, colour=l)) + geom_point(data=d, aes(x=x, y=ypos, colour=l), alpha=0.5)

However, this is unsatisfactory since the y positions must be manually adjusted. Is there a more automatic way to separate graphic cards from different series, for example, by adjusting the position?