I can't seem to re-generate plots (using ggplot2
) that I previously generated using the code below. I now get the error message "No stat called StatHline"
. Is there a replacement?
data <- data.frame(
CorrectedIntensity=c(0, -0.66, -0.37, 0, -1.04, -0.38, 0, -1.89, -1.50),
Day=c("Day 1", "Day 9", "Day 5", "Day 1", "Day 9", "Day 5", "Day 1", "Day 9", "Day 5"))
library(ggplot2)
plot_data <- ggplot() +
ylim(-2.5, 0.5) +
geom_point(data=data, aes(x=Day, y=CorrectedIntensity), size=7,
colour="royalblue3", alpha=0.30) +
geom_errorbar(data=data, aes(x=Day, y=CorrectedIntensity, ymax=..y.., ymin=..y..),
stat = "hline", yintercept = "mean", width=0.3, colour="royalblue3",
size=1.25) +
stat_summary(data=data, aes(x=Day, y=CorrectedIntensity),
fun.ymax=function(i) mean(i) + sd(i),
fun.ymin=function(i) mean(i) - sd(i),
geom="errorbar", width=0.1, colour="royalblue3")
This is what I want the plot to look like: