I would like to make each point on the graph a different color from the line. Here is sample data.
df <- structure(list(yrmonth = structure(c(17167, 17167, 17
You could use a filled point marker (shapes 21 through 25), which would allow you to set the fill colors for the points separately from the colors of the lines. In the code below, I use the same hues (the h
argument to the hcl
function) for the points and lines, but a lower luminance (the l
argument to hcl
) for the points so that they will be darker than the lines. I've also increased the line and point sizes to make it easier to see the difference.
ggplot(df, aes(x=yrmonth,y=data)) +
geom_line(size=1, aes(colour=factor(index))) +
geom_point(size=3, aes(fill=factor(index)), shape=21, colour="#FFFFFF00") +
scale_colour_manual(values=hcl(seq(15,375,length=4)[1:3], 100, 70)) +
scale_fill_manual(values=hcl(seq(15,375,length=4)[1:3], 100, 40)) +
theme_classic() +
labs(colour="Index", fill="Index")