Re: [R] ggplot2: facet_grid with different vertical lines on each facet

2010-11-09 Thread Ista Zahn
Hi Scott, You can put the vline data in a separate data.frame: dat <- data.frame(x=rnorm(20), y=rnorm(20), z=rep(c("a", "b"), each=10)) vline.dat <- data.frame(z=levels(dat$z), vl=c(0,1)) library(ggplot2) ggplot(dat, aes(x=x, y=y)) + geom_point() + geom_vline(aes(xintercept=vl), data=vline.da

[R] ggplot2: facet_grid with different vertical lines on each facet

2010-11-09 Thread Scott Chamberlain
Hello, I am plotting many histograms together using facet_grid in ggplot2. However, I want to then add a vertical line to each histogram, or facet, each of which vertical lines are at different x-values. The following example adds all vertical lines to each facet: ggplot(data,aes(values)) + geom_