Geom_point(aes(x = id, y = ref, color = factor(id), shape = 'ref'), size = 8) + Geom_point(aes(x = id, y = value, color = factor(id), shape = 'value'), size = 6) + You can manually build a shape legend using scale_shape_manual: library(ggplot2) any suggestion on how I could only show a legend related to the different dot shapes would be welcome. P2 = ggplot(shapes, aes(shape, pch)) + geom_point()Īttempt to select less than one element in get1indexįor which I did not find a working solution. I've also tried making a secondary plot, but not display it, using something suggested in one of the links pasted above: shapes = ame(shape = c("value", "reference", "minimum"), pch = c(19,0,2), col = c("gray", "gray", "gray"))
Guides(colour = guide_legend(override.aes = list(shape = override.shape, linetype = override.linetype))).
Instead, I would like to have a legend of what the actual shapes of each dot represent (e.g., filled round dot = value, triangle = min, square = ref).Īmong trying to manually set the scale values via scale_fill_manual and something along those lines override.shape = shapes$shape I know I can remove the legend via theme(legend.position = "none"). Now all is fine, but my legend doesn't add anything to the interpretation of the plot, as the X axis and colors are enough to understand it. Geom_point(aes(x = id, y = min, color = factor(id)), shape = 2, size = 8) + Geom_point(aes(x = id, y = ref, color = factor(id)), shape = 0, size = 8) + Geom_point(aes(x = id, y = value, color = factor(id)), shape = 19, size = 6) + I've tried this and this and following this among others.įor instance, let's say I have a df like this one: df = ame(id = c("A", "A", "B", "C", "C", "C"),Īnd I want to display the values of each id as round dots, but also put the reference values and minimum values for each id as a differently shaped dot, as follows: p = ggplot(data = df) + I've searched and tried a bunch of suggestions to be able to display a custom legend instead of the default one in a grouped scatter ggplot.