我正在使用此代码在单个页面中绘制变量列表:
plot30 <- list(HMn25_30,HMn28_30,HMn29_30,HMn31_30,HMn32_30)
par(mfrow=c(2,3))
for (i in plot30) {
plot(i, type = "o", pch = 16, lty = 2, col = "Black", xlab = "Hour 2007/09/30" , ylab = "Ambient Tempreture")
}
此代码的结果:
我想在节目中添加{节点25,节点28,节点29,节点31,节点32}等标题。
有什么建议吗?
答案 0 :(得分:3)
尝试在for循环中添加以下内容
plot30 <- list(HMn25_30,HMn28_30,HMn29_30,HMn31_30,HMn32_30)
Main <- c('Node 25','Node 28','Node 29','Node 31','Node 32')
par(mfrow=c(2,3))
for (i in seq_along(plot30)) {
plot(plot30[[i]], type = "o", pch = 16, lty = 2, col = "Black", xlab = "Hour 2007/09/30" , ylab = "Ambient Tempreture", main=Main[i])
}
答案 1 :(得分:2)
这是你应该扩展的构造:
plot30 <- list(myplot)
names(plot30)<- c('myplot1')
for (i in seq_along(plot30) ) {pname <- names(plot30)[i]
plot(plot30[i], main=pname)
}