Jonie_Y
代码:
####plot the m0N
pic_data <- data.frame(x = t, y = m0t, z = apply(m0N, 2, mean))
filename3 <- paste("Pic_CL", fmodeli, cr, tr, "pdf", sep = ".")
pdf(filename3, width = 5, height = 4)
g <- ggplot(data = pic_data, aes(x = x, y = z))
g + geom_abline(slope = D1, intercept = D2, color = "#56B4E9", size = 0.5) + geom_point(
size = 0.5) + xlab("t") + ylab("m0(t)") + annotate(
"text", x = 0.8, y = 0.45, label = "n = ") + annotate(
"text", x = 0.86, y = 0.45, label = n) + annotate(
"text", x = 0.84, y = 0.4, label = "cr = tr = ") + annotate(
"text", x = 0.94, y = 0.4, label = cr)
ggsave(filename3, width = 10, height = 6, units = "cm")
dev.off()
运行结果:
Time difference of 12.59397 secs
There were 50 or more warnings (use warnings() to see the first 50)
这些警告信息是画图之前的代码产生的,如果单独运行贴出来的代码,是不报错的,pdf正常打开.
如果直接全部运行所有代码,有pdf,但是打不开。显示“文件不含页面”.