[R] ggplot2: Adding points to a density plot

2010-03-31 Thread Johannes Graumann
Hi, Consider something like library(ggplot2) movies$decade - round_any(movies$year, 10) m - qplot(rating,data=movies,colour=factor(decade),geom=density) m (modified from ?stat_density). I'd like to add on the line y=0 a dot for the median of each decade category (using the same colour

Re: [R] ggplot2: Adding points to a density plot

2010-03-31 Thread Dennis Murphy
Hi: Try this: library(ggplot2) movmed - ddply(movies, .(decade), summarise, med = median(rating)) m + geom_point(data = movmed, aes(x = med), y = 0, size = 2) HTH, Dennis On Wed, Mar 31, 2010 at 4:46 AM, Johannes Graumann johannes_graum...@web.de wrote: Hi, Consider something like

Re: [R] ggplot2: Adding points to a density plot

2010-03-31 Thread Johannes Graumann
Thanks a lot! This got me started! Joh Dennis Murphy wrote: Hi: Try this: library(ggplot2) movmed - ddply(movies, .(decade), summarise, med = median(rating)) m + geom_point(data = movmed, aes(x = med), y = 0, size = 2) HTH, Dennis On Wed, Mar 31, 2010 at 4:46 AM, Johannes