任何人都可以告诉我这个脚本出了什么问题?我需要两条水平的黑色虚线,但我得到了两条连续的红色。尽管使用了theme_bw,但我也无法将绘图边距的颜色更改为黑色,而且箱线图的填充也不是灰色的,根据需要。
dat1 <- data.frame (xvar = rep(c("A", "B"), each=10),
yvar = 1:20 + rnorm(20,sd=3))
ggplot(dat1, aes(x=xvar, y=yvar)) +
theme_bw()+
geom_boxplot(fill=grey)+
geom_hline(aes(yintercept=40, color="black", linetype="dashed"))+
geom_hline(aes(yintercept=33.84, color="black", linetype="dashed"))+
scale_x_discrete(name="") +
scale_y_continuous(name="temperature (°C)")+
opts(
panel.grid.major = theme_line(size = 0.5, colour = NA),
panel.background = theme_rect(colour = NA),
axis.title.y = theme_text(angle=90,face="bold", colour="black", size=14),
axis.text.y = theme_text(face="bold",angle=0, size=14,colour="black"),
axis.title.x = theme_text(face="bold", colour="black", size=14),
axis.text.x = theme_text( size=14,vjust=1.2, colour=NA))
多谢!