I am new to ggplot2 . I would like to create a line graph that has points on them, where the points are filled with different colors than the lines (see. The graph below).
Suppose the dataset I'm working with is the following:
set.seed(100) data<-data.frame(dv=c(rnorm(30), rnorm(30, mean=1), rnorm(30, mean=2)), iv=rep(1:30, 3), group=rep(letters[1:3], each=30))
I tried the following code:
p<-ggplot(data, aes(x=iv, y=dv, group=group, pch=group)) + geom_line() + geom_point() p + scale_color_manual(values=rep("black",3))+ scale_shape(c(19,20,21)) + scale_fill_manual(values=c("blue", "red","gray")) p + scale_shape(c(19,20,21)) + scale_fill_manual(values=c("blue", "red","gray"))
But I donβt understand what I want. Hope someone can point me in the right direction. Thanks!
colors r plot ggplot2
Alex
source share