如何更改箱线图中的填充颜色
How can I change the fill color in 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 箱线图美学的所有方法: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")
我想用下面的代码改变箱线图中的填充颜色,但是代码颜色只改变了边框的颜色。
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 箱线图美学的所有方法: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")