'data.frame': 3 obs. of 3 variables:
$ .A. : num 10 50 80
$ Press : num NA 2 3
$ Action: Factor w/ 3 levels ".a.",".b.",".c.": 1 2 3
# => Action seems OK as an aesthetic for linetype.
# To simplify matters,
y2$A <- y2[[".A."]] # copy .A. to A
# Reformulate the call so that A is the only
# common aesthetic among layers, since A is now in both
# y1.m and y2. No legend for linetype appears.
ggplot(y1.m, aes(x = A)) +
geom_vline(data = y2, aes(xintercept = A, linetype = Action)) +
geom_point(aes(y = value, color = variable)) +
facet_grid(variable ~ ., scale = "free_y")
# Try to make an explicit legend for linetype...no change.
# (Ditto for scale_linetype_discrete().)
last_plot() + scale_linetype(breaks = levels(y2$Action))
# Redoing the plot and using scale_linetype_manual()
# doesn't help, either:
ggplot(y1.m, aes(x = A)) +
geom_vline(data = y2, aes(xintercept = A, linetype = Action)) +
geom_point(aes(y = value, color = variable)) +
facet_grid(variable ~ ., scale = "free_y") +
scale_linetype_manual(breaks = levels(y2$Action), values = 1:3)
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
<snip US English locale info>
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_0.9.2.1 plyr_1.7.1 reshape2_1.2.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-0 dichromat_1.2-4 digest_0.5.2 grid_2.15.2
[5] gtable_0.1.1 labeling_0.1 MASS_7.3-22 memoise_0.1
[9] munsell_0.4 proto_0.3-9.2 RColorBrewer_1.0-5 scales_0.2.2
[13] stringr_0.6.1
Dennis