如何随时间绘制特定行?例如,我想绘制第 10 行(layer.1 到 5 实际上是第 1 年到第 5 年。
library(raster)
r <- raster(nrow=5, ncol=5)
s <- stack( sapply(1:5, function(i) setValues(r, rnorm(ncell(r), i, 3) )) )
s[]
layer.1 layer.2 layer.3 layer.4 layer.5
[1,] 6.7134890 6.9141251 4.38213123 4.8995302 2.3105321
[2,] 3.4323121 6.1074031 10.12872426 3.6728949 3.2252562
[3,] 4.4370107 3.1397068 5.47572912 1.9692684 4.0064603
[4,] -1.5588723 0.4075960 -0.73333754 6.3589944 5.0355051
[5,] 2.8095750 5.4264553 1.17820009 2.0665198 8.0491221
[6,] 4.3422219 2.1106691 1.08638206 5.0640175 6.8057674
[7,] -3.1072366 -1.1174633 6.28901706 5.0713964 1.8651354
[8,] -0.5628539 2.1868130 1.21288191 0.3114011 3.0452161
[9,] 0.1725606 3.4535112 -1.38043518 3.6439042 5.4005650
[10,] -2.3376856 4.8803363 -0.05927408 7.9275016 4.7013126
[11,] 2.3032655 2.4974161 4.63961513 1.4021305 10.2302589
[12,] 0.4470648 1.1660421 -0.70127807 6.3293479 6.6178080
[13,] 2.5835127 -0.8768809 2.87405383 6.1361518 3.4851934
[14,] -3.2769134 2.1721391 2.17317611 1.4170633 0.6446692
[15,] 1.0771079 -2.5369687 4.89710339 1.8667695 4.4847933
[16,] 7.2532218 3.0210221 0.56993065 2.4564492 6.9473683
[17,] 4.0682441 -0.8198112 4.85259334 7.3296033 8.9541915
[18,] 5.3991328 -0.9818425 1.73782230 2.9220433 4.9865858
[19,] 2.0556183 -0.7470914 5.44869675 1.6452235 4.5236089
[20,] -0.6277883 6.7255821 5.12606765 5.5721351 4.7081256
[21,] 9.0139352 3.1350767 6.59366754 2.0351358 5.1865195
[22,] 7.0598020 0.2869291 7.14368927 9.7213576 0.4251934
[23,] 1.6430309 6.3806803 5.95776881 7.5234383 4.8860264
[24,] 1.9473764 1.5386180 3.89690297 2.5333431 7.7217174
[25,] 0.7960661 -1.5137800 2.84861591 -5.9986647 2.9309536
提前致谢。