【发布时间】:2021-10-16 20:10:26
【问题描述】:
假设以下代码:
library(ggplot2)
library(RCurl)
x <- getURL("https://gist.githubusercontent.com/aronlindberg/dfa0115f1d80b84ebd48b3ed52f9c5ac/raw/3abf0f280a948d6273a61a75415796cc103f20e7/growth_data.csv")
data <- read.csv(text = x)
data <- data[,2:20]
data[cbind(FALSE, t(apply(data[,-1], 1, function(z) duplicated(z)
& z >= max(z))))] <- NA
ts.plot(t(data)+2, gpars = list(col = ggplot2::alpha("black", 0.5),
ylim = c(0.5, 500), xlim = c(2, 20), xlab = "Years",
ylab = "Cumulative Numbers"), log = 'y')
如何在该图中添加一条红色的loess 线?
【问题讨论】:
标签: r plot time-series