It depends on what you're looking for. If you are only creating a single boxplot, you can simply use fill and col outside of aes
library(ggplot2)
library(dplyr)
data(iris)
iris %>% filter(Species == 'setosa') %>%
ggplot(aes(y = Sepal.Length)) +
geom_boxplot(col = 'green', fill = 'green')
Note that col is the colour of the border while fill is the filling of the box. col=NA works by removing the colour around the boxplot.
But if you wish to get control over the colour with multiple groups, this has to be specified in 2 places
- aes(col = group, fill = group), to control the grouping to be coloured
scale_colour_manual / scale_color_manual and scale_fill_manual to control the actual colours chosen for the fill and border respectively.
iris %>%
ggplot(aes(y = Sepal.Length,
fill = Species,
col = Species)) +
geom_boxplot() +
scale_fill_manual(values = c(setosa = 'blue',
versicolor = 'yellow',
virginica = 'orange')) +
scale_colour_manual(values = c(setosa = 'purple',
versicolor = 'green',
virginica = 'black'))

fill = "cornflowerblue"inaes