I want to change the fill color in boxplot with the follwing code, but the code color only change the color of the border.
p = ggplot(data=concentration,aes(factor(status), con), ylim=c(0,0.15),cex.axis=1.5,cex.lab=15) +
stat_summary(fun.data=f, geom="boxplot", position="dodge",color='blue') +
ylab(expression(paste("Formaldehyde concentration"," (",mu,"g/",m^3,")"))) +
xlab("") +
ylim(0,200) #+
geom_boxplot(aes(fill = Condition))
How can I change the fill color?
You can see all the ways to edit the aesthetics of a ggplot boxplot here: http://ggplot2.tidyverse.org/reference/geom_boxplot.html
In your case you want to change the fill:
set.seed(123)
concentration <- data.frame(status = c("Yes", "No"), con = rnorm(n = 30) + 10)
ggplot(data=concentration, aes(factor(status), con)) +
geom_boxplot(fill = "blue")
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments