Can anyone tell me what is happening with this script? I need 2 horizontal, black, dashed lines, but instead I got two red continuations. I also canโt change the color of the graph fields to black, despite the fact that you are using theme_bw, and the boxplot filling is not gray if required.
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))
Many thanks!
source
share