For example,
ggplot(mpg, aes(class, hwy)) + geom_boxplot(
outlier.colour = "black",
outlier.shape = 24,
outlier.fill = "red",
outlier.size = 3
)
based on the example I know that for class compact all outliers were either from volkswagon or toyota
mpg[mpg$class == "compact" & mpg$hwy > 35, ]
As such instead of indiscriminately labeling all outliers as red I want to only the outliers to color coded by manafacturer? I this possible? I tried something like outlier.fill = factor ( mpg$manufacturer)
but that failed.
edit: this is not a duplicate of Coloring boxplot outlier points in ggplot2? because what I need is actually opposite which 1st) to color code by color and not just color 2nd) I don't want to match the aesthetic colors.