r-绘制保存在一系列列表中的平均光栅像素值的XYZ时间序列图



我有2000年至2020年的月平均NDVI值。这些都在一系列列表中,我现在希望生成一个图,其中y轴=年(2000年至2020年(,x轴=月(1月至12月(,平均像素值是每年跨月绘制的。我的数据结构摘录如下。

> str(main_results)
List of 21
$ 2000:List of 12
..$ Jan: num 53175340
..$ Feb: num 53175340
..$ Mar: num 54210607
..$ Apr: num 63805825
..$ May: num 63264070
..$ Jun: num 55204852
$ 2001:List of 12
..$ Jan: num 52421208
..$ Feb: num 52056380
..$ Mar: num 50644054
..$ Apr: num 54343907
..$ May: num 63450964
..$ Jun: num 31621584
$ 2002:List of 12
..$ Jan: num 5.7e+07
..$ Feb: num 52948521
..$ Mar: num 53387318
..$ Apr: num 52480231
..$ May: num 60184070
..$ Jun: num 60203653
$ 2003:List of 12
..$ Jan: num 5.9e+07
..$ Feb: num 46296245
..$ Mar: num 57454065
..$ Apr: num 51364984
..$ May: num 60912416
..$ Jun: num 54743738
$ 2004:List of 12
..$ Jan: num 45387264
..$ Feb: num 47411237
..$ Mar: num 43121839
..$ Apr: num 58219650
..$ May: num 52421337
..$ Jun: num 4.8e+07

以防万一有人陷入困境,需要同样的帮助。我用我的一位主管编写的代码解决了这个问题。这将列表中的结果转换为数据帧

res_mat <- as.data.frame(matrix(unlist(main_results), ncol = 12, nrow = 21, byrow = TRUE))
colnames(res_mat) <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
rownames(res_mat) <- 2000:2020

最新更新