I am trying to get a line + point plot in ggplot using stat_summary. I would like to get separate shapes for each group but the shapes with a white fill and a black border. This is easy enough if you create a table of means first and use this as the dataframe using geom_point(). But I would like to be able to do this with stat_summary.
df <- data.frame(day = rep(0:3, times = 12), score = rnorm(48,5,1), group = rep(letters[1:3], each = 4, times = 4))
ggplot(df, aes(x = day, y = score)) +
stat_summary(fun.y = "mean", geom = "line", aes(linetype = group)) +
stat_summary(fun.y = "mean", geom = "point", aes(shape = group), size = 4)
I have tried manually entering "white" into the values argument of scale_shape_manual but that doesn't work (produces white fill but makes all the shapes the same and has no black border). If I add colour = group
as an aesthetic argument to the 'point' stat_summary layer it gives me different colours.
Is there any way to get different shapes of points for each group but with white fill and black borders?