plot.sppmix: Plot a spatial point pattern

Description Usage Arguments Author(s) See Also Examples

View source: R/normmix_plots.R

Description

Plot a spatial point pattern generated from a Poisson with mixture intensity surface. Alternatively, the function can plot a spatstat ppp object.

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#plot.sppmix

Usage

1
2
3
## S3 method for class 'sppmix'
plot(x, mus, estcomp, open_new_window = FALSE,
  colors = FALSE, showmarks = TRUE, whichmark = 1, ...)

Arguments

x

A point pattern of class sppmix or ppp.

mus

An optional list of the theoretical means of the mixture components.

estcomp

The estimated component label should be a vector whose length should be the same as number of points. If estcomp is not missing, the function will plot the points using different colors according to estcomp. See the example on how to calculate estcomp from a DAMCMC fit. If this variable is missing and we pass a point pattern generated using rsppmix, then the true component labels will be used, otherwise, the function will not plot the points with different colors to indicate the different components.

open_new_window

Open a new window for the plot.

colors

Logical flag requesting to use different colors for the points based on which component they belong to.

showmarks

Logical flag requesting to plot each point with a different circle size according to its mark value. If the mark is a data.frame object (multivariate marks), the first column (mark) is used as the the marks and displayed.

whichmark

If multivariate marks, choose to display this one.

...

Additional parameters to the add_title function. Valid choices are m, n and L. To add a different title than the default, use add_title after the plot call (see examples below).

Author(s)

Jiaxun Chen, Sakis Micheas, Yuchen Wang

See Also

normmix, to_int_surf, owin, rsppmix, est_mix_damcmc, GetMAPLabels, rMIPPP_cond_mark

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
mix1 <- rnormmix(5, sig0 = .01, df = 5, xlim=c(0, 5), ylim=c(0, 5))
intsurf1=to_int_surf(mix1, lambda = 40, win =spatstat::owin( c(0, 5),c(0, 5)))
pp1 <- rsppmix(intsurf1)
plot(pp1)
plot(pp1, mus=intsurf1$mus)
plot(pp1,mus=intsurf1$mus)+add_title(
 "Poisson point pattern along with the true component means", m=intsurf1$m,n=pp1$n)
plot(pp1, mus = intsurf1$mus, lambda = intsurf1$lambda)
plot(pp1, mus = intsurf1$mus)+ add_title(
 "Poisson point pattern along with the true component means", lambda = intsurf1$lambda,
 m=intsurf1$m,n=pp1$n)
#use the demo intensity surface
demo_intsurf
pp2 <- rsppmix(demo_intsurf,marks = 1:3)
plot(pp2)
plot(pp2, mus = demo_intsurf$mus)#plot the mixture means as well
#plot the points with different colors depending on the true component label
plot(pp2, colors = TRUE)
#plot the points with different colors depending on the estimated component label
fit <- est_mix_damcmc(pp2, 2)
est_comp <- GetMAPLabels(fit)
plot(pp2, estcomp = est_comp, colors = TRUE)
#generate and plot a marked point pattern
newMPP=rMIPPP_cond_mark()
plot(newMPP$genMPP, showmarks=TRUE)

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.