show_field: Plot the estimated random field(s) of a fitted LGCP

View source: R/plots.r

show_fieldR Documentation

Plot the estimated random field(s) of a fitted LGCP

Description

Plots the values of x at each node of smesh, with optional control over resolutions using dims.

Usage

show_field(x, smesh, sf, dims = c(500, 500), clip = FALSE)

Arguments

x

A vector of values, one value per each smesh node.

smesh

A Delaunay triangulation of the spatial domain returned by fmesher::fm_mesh_2d().

sf

Optional, sf of type POLYGON specifying the region of the domain.

dims

A numeric vector of length 2 specifying the spatial pixel resolution. Default c(500,500).

clip

Logical, if TRUE then plotted values are 'clipped' to the domain supplied as sf.

Value

A gg class object, values returned by geom_tile and geom_sf.

See Also

show_lambda and get_fields

Examples


if(requireNamespace("fmesher")){
if(require("sf")){
data(xyt, package = "stelfi")
domain <- sf::st_as_sf(xyt$window)
bnd <- fmesher::fm_as_segm(as.matrix(sf::st_coordinates(domain)[, 1:2]))
smesh <- fmesher::fm_mesh_2d(boundary = bnd, max.edge = 0.75, cutoff = 0.3)
parameters <- c(beta = 1, log_tau = log(1), log_kappa = log(1))
simdata <- sim_lgcp(parameters = parameters, sf = domain, smesh = smesh)
show_field(c(simdata$x), smesh = smesh, sf = domain)
show_field(c(simdata$x), smesh = smesh, sf = domain, clip = TRUE)
}
}


cmjt/stelfi documentation built on Oct. 25, 2023, 2:53 p.m.