'Computation failed in `stat_contour_fill()`
I'm trying to generate the contour map of LAI in the forest. I used geom_contour_fill function from the metR package.
My data looks like this
LAI latitude longitude point
2.27 6694613 614612.1 S
1.24 6694613 614616.9 S
0.00 6694612 614621.7 S
0.00 6694612 614626.5 S
0.00 6694612 614631.2 S
2.19 6694611 614636.0 S
2.28 6694611 614640.8 S
1.93 6694610 614645.5 S
1.64 6694610 614650.3 S
1.62 6694609 614655.1 S
The reproducible subset is here
df <- structure(list(LAI = c(2.27, 1.24, 0, 0, 0, 2.19, 2.28, 1.93,
1.64, 1.62, 1.4, 1.08, 0.96, 0.52, 0, 0, 0, 0, 0, 0), latitude =
c(6694613.37592588,
6694612.91961068, 6694612.46329548, 6694612.00698028, 6694611.55066509,
6694611.09434989, 6694610.63803469, 6694610.18171949, 6694609.7254043,
6694609.2690891, 6694608.8127739, 6694608.3564587, 6694607.90014351,
6694607.44382831, 6694606.98751311, 6694606.53119791, 6694606.07488272,
6694605.61856752, 6694605.16225232, 6694604.70593712), longitude =
c(614612.134729696,
614616.908283926, 614621.681838155, 614626.455392385, 614631.228946615,
614636.002500844, 614640.776055074, 614645.549609304, 614650.323163533,
614655.096717763, 614659.870271993, 614664.643826222, 614669.417380452,
614674.190934682, 614678.964488911, 614683.738043141, 614688.511597371,
614693.2851516, 614698.05870583, 614702.83226006), point = c("S",
"S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
"S", "S", "S", "S", "S", "S")), row.names = c(NA, 20L), class =
"data.frame")
This is my code
ggplot(df, aes(x = longitude, y = latitude, z = LAI))+ geom_contour_fill(na.fill = TRUE)
I got the error message: Computation failed in stat_contour_fill()
:
Supplied 2 columns to be assigned an empty list (which may be an empty data.table or data.frame since they are lists too). To delete multiple columns use NULL instead. To add multiple empty list columns, use list(list()).
I've used the same code to produce the contour map for the other dataset and it worked fine, but it didn't work this time. I suspect the error is due to the decimal in the longitude column. I can't figure out the root cause and the solution.
Thanks for the help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|