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
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_
2 matches
Mail list logo