Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 操纵图表选择多个时间序列_R_Plot_Time Series_Timeserieschart - Fatal编程技术网

R 操纵图表选择多个时间序列

R 操纵图表选择多个时间序列,r,plot,time-series,timeserieschart,R,Plot,Time Series,Timeserieschart,我已经创建了下面的图,这样我就可以很容易地比较不同时间段的多个时间序列。接下来,我想添加一个选择器,这样我可以选择多个时间序列同时在绘图上查看,并取消选中我不想在绘图上看到的时间序列 代码: 你可以这样做 y<-c(9.5, 9, 14.5, 22.5, 13, 16, 22, 31.5, 51, 43) r<-c(20, 18, 17, 16, 15, 15, 14, 14, 14, 14) require(graphics) require(manipulate) manipul

我已经创建了下面的图,这样我就可以很容易地比较不同时间段的多个时间序列。接下来,我想添加一个选择器,这样我可以选择多个时间序列同时在绘图上查看,并取消选中我不想在绘图上看到的时间序列

代码:


你可以这样做

y<-c(9.5, 9, 14.5, 22.5, 13, 16, 22, 31.5, 51, 43)
r<-c(20, 18, 17, 16, 15, 15, 14, 14, 14, 14)
require(graphics)
require(manipulate)
manipulate({ 
  lines <- list(if (chk.y) ts(y), if(chk.r) ts(r))
  cols <- c(if (chk.y) "red", if (chk.r) "green")
  do.call(ts.plot, c(lines, list(gpars=list(col=cols, xlab="t", ylab="y"))))
}, 
  chk.y=checkbox(TRUE, "y"),
  chk.r=checkbox(TRUE, "r")
)

yI似乎无法下载软件包、图形。每个dput分配给什么?我非常困惑。请重写一下!另外,请告诉我们下载“minipulate”软件包。谢谢你,对你的代码稍加修改就可以了<代码>y
dput(series1[1:10])
c(9.5, 9, 14.5, 22.5, 13, 16, 22, 31.5, 51, 43)


dput(series2[1:10])
c(20.3368220204774, 18.0733372276398, 16.61695493123, 15.6798824136643, 
15.0769466973063, 14.6890028922692, 14.4393902191708, 14.2787832298018, 
14.175444706505, 14.1089541357078)

dput(series3[1:10])
c(17.8189147557743, 22.3815592342001, 16.108169527143, 21.0654757276344, 
16.3878646132368, 18.9345933680916, 16.634277276197, 15.4322081636797, 
20.2884280389731, 12.2089595405668)
y<-c(9.5, 9, 14.5, 22.5, 13, 16, 22, 31.5, 51, 43)
r<-c(20, 18, 17, 16, 15, 15, 14, 14, 14, 14)
require(graphics)
require(manipulate)
manipulate({ 
  lines <- list(if (chk.y) ts(y), if(chk.r) ts(r))
  cols <- c(if (chk.y) "red", if (chk.r) "green")
  do.call(ts.plot, c(lines, list(gpars=list(col=cols, xlab="t", ylab="y"))))
}, 
  chk.y=checkbox(TRUE, "y"),
  chk.r=checkbox(TRUE, "r")
)