
Last chance! 50% off unlimited learning
Sale ends in
This functions implements a plot method for a lasmetrics
data.frame
# S3 method for lasmetrics
plot(x, z = NULL, colorPalette = height.colors, ...)
A data.frame or data.table of class lasmetrics
.
character. The field to plot. If NULL, autodetect.
function. A color palette function. Default is height.colors
provided by the package lidR
Supplementary parameters for plot
The … param provides additional arguments to plot.
grid_metrics grid_canopy height.colors forest.colors heat.colors colorRampPalette
# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)
# Canopy surface model with 4 m^2 cells
grid_canopy(lidar) %>% plot
# Mean height with 400 m^2 cells
grid_metrics(lidar, mean(Z)) %>% plot
# Define your own metric function
myMetrics = function(z, i, angle, pulseID)
{
ret = list(
npulse = length(unique(pulseID)),
hmean = mean(z),
hmax = max(z),
imean = mean(i),
angle = mean(abs(angle))
)
return(ret)
}
metrics = grid_metrics(lidar, myMetrics(Z, Intensity, ScanAngle, pulseID))
plot(metrics, "hmean")
plot(metrics, "hmax")
plot(metrics, "imean")
# }
Run the code above in your browser using DataLab