View source: R/visualizations.R
transectPlot | R Documentation |
Plots cell values along a vertical transect
transectPlot(
rast = NULL,
sampleAxis = "lon",
axisValue = NA,
scaleRange = NA,
plotLegend = TRUE,
depthLim = as.numeric(max(names(rast))),
transRange = c(-90, 90),
transTicks = 20,
verbose = FALSE,
...
)
rast |
A multilayer |
sampleAxis |
Specifies whether a latitudinal ("lat") or longitudinal ("long") transect is desired. |
axisValue |
Numeric value specifying transect postion. |
scaleRange |
A numeric vector of length 2, specifying the range that should be used for the plot color scale. |
plotLegend |
|
depthLim |
A single vector of class |
transRange |
A |
transTicks |
|
verbose |
|
... |
Additional optional arguments to pass to |
A ggplot
showing a vertical slice through the SpatRaster
.
Only unprojected SpatRaster
files are supported.
library(terra)
rast1 <- rast(ncol=10, nrow=10)
values(rast1) <- rep(0:3, 50)
rast2 <- rast(ncol=10, nrow=10)
values(rast2) <- c(rep(0, 50), rep(1,25), rep(2,25))
rast3 <- rast(ncol=10, nrow=10)
values(rast3) <- rep(c(1,3,2,1), 25)
distBrick <- c(rast1, rast2, rast3)
names(distBrick) <- c(0:2)
transectPlot(distBrick, depthLim = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.