Skip to contents

Use ggplot2 package to visualize the coherence and partial coherence.

Usage

plot_coher(sp.est, coh.mat, partial.coh.mat, xnorm = TRUE, ylim = NULL)

Arguments

sp.est

List. The kernel spectral density estimate from periodogram_smooth().

coh.mat

Coherence matrix from coherence() with type = "normal".

partial.coh.mat

Partial coherence matrix from coherence() with type = "partial".

xnorm

Logical. If TRUE (default), plot the radial averaged values. If FALSE, plot the raw coherence and partial coherence values via heatmap.

ylim

A numeric vector c(lower, upper) to specify the range to draw for the radially-averaged plot. Not required if xnorm = FALSE.

See also

Examples

library(spatstat)
lam <- function(x, y, m) {(x^2 + y) * ifelse(m == "A", 2, 1)}
set.seed(227823)
spp <- rmpoispp(lambda = lam, win = square(5), types = c("A","B"))

KSDE.list <- periodogram_smooth(spp, inten.formula = "~ x + y", bandwidth = 1.15)
coh.partial <- coherence(KSDE.list, spp)
#> Number of frequencies to pick the maximum partial coherence: 9 (this value should not be too small).
coh <- coherence(KSDE.list, spp, type = "normal")
#> Number of frequencies to pick the maximum coherence: 9 (this value should not be too small).
plot_coher(KSDE.list, coh, coh.partial)