提取在 levelplot 函数的边缘绘制的结果
Extract the results plotted in the margin of the levelplot function
如何提取绘制在 levelplot 函数边缘的结果?
或者有做同样事情的函数吗?
我正在搜索 table...
此致,
library(raster)
library(rasterVis)
library(gridExtra)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
x <- levelplot(r, margin=T)
来自rasterVis::levelplot
的帮助页面:
[These] marginal graphics show the column (x) and row (y) summaries of
the Raster*
object. The summary is computed with the function
mean
.
您应该使用 raster::zonal
函数来计算它们:
rx <- init(r, 'x')
mx <- zonal(r, rx, FUN = mean)
plot(mx, type = 'l')
如何提取绘制在 levelplot 函数边缘的结果?
或者有做同样事情的函数吗?
我正在搜索 table...
此致,
library(raster)
library(rasterVis)
library(gridExtra)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
x <- levelplot(r, margin=T)
来自rasterVis::levelplot
的帮助页面:
[These] marginal graphics show the column (x) and row (y) summaries of the
Raster*
object. The summary is computed with the functionmean
.
您应该使用 raster::zonal
函数来计算它们:
rx <- init(r, 'x')
mx <- zonal(r, rx, FUN = mean)
plot(mx, type = 'l')