I saw some answers for my question in a recent search, but none of them worked for me.
I would like to plot a geom_jitter() divide by 3 groups and add the average line for each group. So far, I have the following code. But it is still not good.
library(ggplot2)
data("iris")
iris.summary <- aggregate(. ~ Species, mean, data=iris)
ggplot(iris, aes(x=Species, y=Sepal.Width, shape=Species)) +
geom_jitter(width=0.2) + geom_hline(data=iris.summary, size=1,
col="red", aes(yintercept=Sepal.Width))
Which is producing the following graph:
How can I set the red lines to the edge of the points?
Thanks in advance,
Rhenan Bartels