1

我正在使用此代码在单个页面中绘制变量列表:

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")
}

此代码的结果: 在此处输入图像描述

我想在图中添加诸如 {Node 25,Node 28,Node 29,Node 31,Node 32} 之类的标题。

有什么建议吗?

4

2 回答 2

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])
}
于 2013-01-09T20:50:31.290 回答
2

这是您应该扩展的结构:

plot30 <- list(myplot)
names(plot30)<- c('myplot1') 
for (i in seq_along(plot30) )  {pname <- names(plot30)[i]
  plot(plot30[i],  main=pname)
}
于 2013-01-09T20:49:20.493 回答