【发布时间】:2017-04-17 00:12:36
【问题描述】:
我有以下代码可以使用 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")
出现以下错误信息:
Warning message:
In eval(expr, envir, enclos) : NaNs produced
这是结果图:
顶部的绿色条是什么?它们为什么会出现,我该如何摆脱它们?
【问题讨论】:
-
不能说没有数据,这可能是它的原因(抱歉,我无法访问 Dropbox)。顺便说一句,只是一些友好的建议:您个人可能认为 dplyr 是上帝赐给 R 编程的礼物,但其他一些人则不然。如果您使用基数 R 进行简单的子集化操作,则会增加潜在的回答者池。无论如何,子集与您的问题无关,不应成为 minimal reproducible example. 的一部分
标签: r plot ggplot2 statistics nan