plotable_tess: Create Plotable Tesselation from a Point Pattern.

Description Usage Arguments Value Examples

View source: R/polygonal-2d.R

Description

plotable_tess returns a dataframe of points defining the edges of the tessellation constructed by polydeclust2d. These points can be used to visualize the tessellations.

Usage

1

Arguments

points

2D point pattern object created by package spatstat. It must have a window defined using a binary mask.

Value

A simple features (sf) polygons dataframe. May be plotted with geom_sf.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(ggplot2)

# Tessellation with a mask only may produce excessive edge weights.
dec <- polydeclust2d(samples$x, samples$y, mask = mask, estdomain = FALSE)
samples_dec <- cbind(samples, dec$weights)
ptess <- plotable_tess(dec$ppp)
ggplot() +
  geom_raster(data = mask, aes(x, y), fill = "lightblue") +
  geom_sf(data = ptess, fill = NA) +
  geom_point(data = samples_dec, aes(x, y, size = weight))

# Using the `ripras` option reduces excessive edge weights.
dec <- polydeclust2d(samples$x, samples$y, mask = mask)
samples_dec <- cbind(samples, dec$weights)
ptess <- plotable_tess(dec$ppp)
ggplot() +
  geom_raster(data = mask, aes(x, y), fill = "lightblue") +
  geom_sf(data = ptess, fill = NA) +
  geom_point(data = samples_dec, aes(x, y, size = weight))

truemoid/declustr documentation built on May 20, 2019, 9:57 a.m.