Learn R Programming

lidR (version 2.1.4)

plot: Plot a LAS* object

Description

Plot displays a 3D interactive windows-based on rgl for LAS objects Plot displays an interactive view for LAScatalog objects with pan and zoom capabilities based on mapview. If the coordinate reference system (CRS) of the LAScatalog is non empty, the plot can be displayed on top of base maps (satellite data, elevation, street, and so on). Plot displays a LASheader object exactly like it displays a LAScatalog object.

Usage

plot(x, y, ...)

# S4 method for LAS,missing plot(x, y, color = "Z", colorPalette = height.colors(50), bg = "black", trim = Inf, backend = c("rgl", "pcv"), clear_artifacts = TRUE, nbits = 16, axis = FALSE, legend = FALSE, ...)

# S4 method for LAScatalog,missing plot(x, y, mapview = FALSE, chunk_pattern = FALSE, ...)

# S4 method for LASheader,missing plot(x, y, mapview = FALSE, ...)

Arguments

x

A LAS* object

y

Unused (inherited from R base)

...

Will be passed to points3d (LAS) or plot if mapview = FALSE or to mapview if mapview = TRUE (LAScatalog).

color

characters. The attribute used to color the point cloud. Default is Z coordinates. RGB is an allowed string even if it refers to three attributes simultaneously.

colorPalette

characters. A vector of colors such as that generated by heat.colors, topo.colors, terrain.colors or similar functions. Default is height.colors(50) provided by the package lidR

bg

The color for the background. Default is black.

trim

numeric. Enables trimming of values when outliers break the color palette range. Every point with a value higher than trim will be plotted with the highest color.

backend

character. Can be "rgl" or "pcv". If "rgl" is chosen the display relies on the rgl package. If "pcv" is chosen it relies on the PointCloudViewer package, which is much more efficient and can handle million of points using less memory. PointCloudViewer is not available on CRAN yet and should be installed from github (see. https://github.com/Jean-Romain/PointCloudViewer).

clear_artifacts

logical. It is a known and documented issue that the 3D visualisation with rgl displays artifacts. The points look aligned and/or regularly spaced in some view angles. This is because rgl computes with single precision float. To fix that the point cloud is shifted to (0,0) to reduce the number of digits needed to represent its coordinates. The drawback is that the point cloud is not plotted at its actual coordinates.

nbits

integer. If color = RGB it assumes that RGB colors are coded on 16 bits as described in the LAS format specification. However, this is not always respected. If the colors are stored on 8 bits set this parameter to 8.

axis

logical. Display axis on XYZ coordinates.

legend

logical. Display a gradient color legend.

mapview

logical. If FALSE the catalog is displayed in a regular plot from R base.

chunk_pattern

logical. Display the current chunk pattern used to process the catalog.

Examples

Run this code
# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las <- readLAS(LASfile)

plot(las)

# Outliers in intensity break the color range. Use the trim parameter.
col <- heat.colors(50)
plot(las, color = "Intensity", colorPalette = col)
plot(las, color = "Intensity", colorPalette = col, trim = 70)

# single file catalog using data provided in lidR
ctg = readLAScatalog(LASfile)
plot(ctg)

# }

Run the code above in your browser using DataLab