如何将带有轮廓线的绘图应用于数据框列表

问题描述

我希望将绘图功能应用于数据框列表并保存到指定的文件夹中。我能够绘制点,但无法确定如何将底线应用于每个对应的图。下方plot命令中的数据帧a是列表ds1中的单个数据帧。 m命令中的matlines是一个较大数组model.one中的mcarray的单个列表,用于40个样本。

structure(list(X = 271:279,RunTime = c(110.7456193,10.29555673,23.64595448,36.49562995,47.69554832,60.24535378,72.49592154,84.59610247,94.04568292),rad = c(0L,112L,180L,272L,351L,430L,482L,541L,609L),value = c(233.2387405,209.8006377,212.0638549,215.3483471,219.3000462,223.5726513,228.6726164,233.3633682,237.0504306),ID = c(3L,3L,3L),coefficients..Intercept. = c(281.6626635,209.8700852,207.1099171,201.5211056,196.3326852,194.8341761,192.8200506,199.4736392,182.1788075),coefficients.x1 = c(-0.437317635,0.022265912,0.20820413,0.375518671,0.479472476,0.480583864,0.497020482,0.400718379,0.586395654),R.squared = c(0.954030672,0.355701698,0.857345184,0.948827169,0.967127094,0.954887542,0.946878654,0.93366159,0.958896684),std.error..Intercept. = 
c(1.049993511,0.08559681,0.18204786,0.299970875,0.404005375,0.609778088,0.832852025,0.886205157,1.123158853),std.error.x1 = 
c(0.009696988,0.010763137,0.008579099,0.008809366,0.008929516,0.010551842,0.011891828,0.010789815,0.012263946),Date = 
structure(c(18155,18155,18155),class = "Date")),row.names = 271:279,class = "data.frame")

str(m)
List of 7
 $ alpha: 'mcarray' num [1,1:2000,1:16] 0.00581 0.0057 0.00545 0.00231 0.00372 ...
  ..- attr(*,"varname")= chr "alpha"
 $ beta : 'mcarray' num [1,1:16] 0.000555 0.001245 0.000348 0.000402 0.000165 ...
  ..- attr(*,"varname")= chr "beta"
 $ Pmax : 'mcarray' num [1,1:16] 1.36 1.84 1.13 1.56 1.15 ...
  ..- attr(*,"varname")= chr "Pmax"
 $ R    : 'mcarray' num [1,1:16] -0.446 -0.499 -0.418 -0.166 -0.359 ...
  ..- attr(*,"varname")= chr "R"
 $ mu   : 'mcarray' num [1:9,1:16] -0.4463 0.0474 0.2311 0.3891 0.468 ...
  ..- attr(*,"varname")= chr "mu"
 $ sigma: 'mcarray' num [1,1:16] 0.103 0.0973 0.0997 0.0972 0.0957 ...
  ..- attr(*,"varname")= chr "sigma"
 $ mu.pr: 'mcarray' num [1:81,1:16] -0.446 -0.39 -0.336 -0.285 -0.236 ...
  ..- attr(*,"varname")= chr "mu.pr"

plot(coefficients.x1 ~ rad,a,pch = 16)
matlines(I.pr,t(apply(m$mu.pr,1,function(x) c(mean(x),quantile(x,c(0.025,0.975))))),lty = 1)

我想做的是使用上面的代码生成40个(所有样本)单独的图形,看起来像下面的图形。我尝试了以下失败的尝试:

lapply(ds1,function(x) {
  plot(coefficients.x1 ~ rad,x,pch = 16)
  matlines(I.pr,t(apply(model.one$mu.pr,lty = 1)
})

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)