I created a line plot using ggplot that has 10 lines, and added points (of different shapes) to only two of the lines using subset. However, the legend shows points on all of the lines. Is there a way to make the legend only show a point (of the right shape) on the line that has the points? Here is my code:
aplot <- ggplot(weekly, aes(x=week, y=alpha, group=bin, color=bin))
+geom_line()
aplot <- aplot +geom_point(aes(x=week, y=alpha, group=bin,
color=bin), size=3, shape=16, subset(weekly, bin %in% c("b")))
aplot <- aplot +geom_point(aes(x=week, y=alpha, group=bin, color=bin),
size=3, shape=17, subset(weekly, bin %in% c("t")))
where the data.frame weekly looks something like:
bin week alpha
b 1 10
b 2 12
b 3 16
t 1 14
t 2 18
t 3 8
m 1 13
m 2 19
m 3 9
. . .
. . .
. . .
Thanks!