我想使用以下代码更改 boxplot 中的填充颜色,但代码颜色仅更改边框的颜色。
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))
如何更改填充颜色?
您可以在此处查看编辑 ggplot boxplot 美学的所有方法:http ://ggplot2.tidyverse.org/reference/geom_boxplot.html
在您的情况下,您要更改填充:
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")
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句