I have the following code to make a plot using ggplot2 (here is the data file):
sig1 <- ggplot(var_dat_df %>%
filter(!(variable %in% c("LogDiffSq", "cusum_ker", "de_ker", "hr_ker"))),
aes(x = i, y = -log10(value), group = variable, color = variable)) +
geom_line() +
scale_color_manual(values = c("#1b9e77", "#d95f02", "#7570b3"),
labels = c("CUSUM", "DE", "HR"),
name = "Statistic") +
geom_hline(yintercept = -log10(0.05), color = "red", linetype = "dashed") +
scale_y_continuous(breaks = c(-log10(0.05), 5, 10, 15, 17),
labels = expression(alpha, 5, 10, 15, 17)) +
xlab("Index") + ylab(expression(-log[10](p))) +
labs(title = "Statistical Significance of Detected Change",
subtitle = "Without Using Kernel Estimation for Long-Run Variance") +
theme_bw() +
theme(plot.title = element_text(size = rel(2)),
legend.position = "bottom")
The following error message appears:
Warning message:
In eval(expr, envir, enclos) : NaNs produced
Here is the resulting figure:
What are the green bars at the top? Why do they appear, and how can I get rid of them?