Description Usage Arguments Author(s) See Also Examples
Create a 2d image or contour plot of the intensity surface, with the option to display a point pattern.
For examples see
http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#plotmix_2d
1 2 3 |
intsurf |
Object of class |
pattern |
Optional spatial point pattern
to add to the plot. This is an object of
class |
estcomp |
The estimated component label should be a vector whose length
should be the same as number of points. If |
contour |
Logical flag requesting the countour plot only. |
truncate |
Logical variable indicating that the points should be within the window of observation. Default is TRUE. |
L |
Length of the side of the square grid. The intensity is calculated on an L * L grid. The larger this value is, the better the picture resolution. |
open_new_window |
Open a new window for the plot. |
grayscale |
Plot in gray scale. Default is FALSE (use colors). |
colors |
Logical flag requesting to use different colors for the points based on which component they belong to. |
... |
Additional parameters passed to |
Jiaxun Chen, Sakis Micheas, Yuchen Wang
normmix
,
to_int_surf
,
owin
,
rsppmix
,
GetMAPLabels
,
est_mix_damcmc
,
PlotUSAStates
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 26 27 28 29 30 31 | # plot normmix density
truemix<- rnormmix(m = 3, sig0 = .1, df = 5, xlim= c(0, 5), ylim = c(0, 5))
summary(truemix)
intsurf=to_int_surf(truemix, lambda = 100, win =spatstat::owin( c(0, 5),c(0, 5)))
#plot the intensity surface
plotmix_2d(intsurf)
plotmix_2d(intsurf,contour = TRUE)
pp1 <- rsppmix(intsurf = intsurf)# draw points
plotmix_2d(intsurf, pp1)
plotmix_2d(intsurf, pp1,contour = TRUE)
#fit a Poisson with mixture intensity surface
CAgens=est_mix_damcmc(pp = CAQuakes2014.RichterOver3.0, m = 5)
#retrieve the surface of posterior means
CAfit=GetPMEst(CAgens)
#plot the surface and the point pattern
plotmix_2d(CAfit,CAQuakes2014.RichterOver3.0)
#to include the state boundaries use function PlotUSAStates
ret=PlotUSAStates(states=c('California','Nevada','Arizona'), showcentroids=FALSE,
shownames=TRUE, main="Earthquakes in CA, 2014", pp=CAQuakes2014.RichterOver3.0,
surf=CAfit, boundarycolor="white", namescolor="white")
#plotting the points with different colors depending on the component they belong to
truemix <- rnormmix(m = 5, sig0 = .1, df = 5, xlim=c(-2,2), ylim=c(-2,2))
intsurf=to_int_surf(truemix, lambda = 100, win = spatstat::owin(c(-2,2),c(-2,2)))
pp1 <- rsppmix(intsurf)
#plot the points with different colors depending on the true component label
plotmix_2d(intsurf,pp1, colors = TRUE)
#plot the points with different colors depending on the estimated component label
fit <- est_mix_damcmc(pp1, 5)
est_comp <- GetMAPLabels(fit)
plotmix_2d(intsurf,pp1, estcomp = est_comp, colors = TRUE)
plotmix_2d(intsurf,pp1, estcomp = est_comp, contour = TRUE,colors = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.