How can I color the outlier points in ggplot2? I want them to be the same color as the boxplot itself. colour=
is not enough to do this.
Example:
<
Update (2015-03-31): see @tarch's solution for ggplot2 >= 1.0.0
solution for ggplot2
<= 0.9.3 is below.
As @koshke said, having the outliers colored like the lines of the box (not the fill color) is now easily possible by setting outlier.colour = NULL
:
p <- ggplot(mtcars, aes(x=factor(cyl), y=mpg, col=factor(cyl)))
p + geom_boxplot(outlier.colour = NULL)
outlier.colour
must be written with "ou"outlier.colour
must be outside aes ()
I'm posting this as a late answer because I find myself looking this up again and again and I posted it also for the related question Boxplot, how to match outliers' color to fill aesthetics?