plot.global_envelope | R Documentation |
Plot method for the class 'global_envelope'
## S3 method for class 'global_envelope'
plot(
x,
dotplot = length(x$r) < 10,
sign.col = "red",
labels = NULL,
digits = 3,
...
)
x |
An 'global_envelope' object |
dotplot |
Logical. If TRUE, then instead of envelopes a dot plot is done. Suitable for low dimensional test vectors. Default: TRUE if the dimension is less than 10, FALSE otherwise. |
sign.col |
The color for the observed curve when outside the global envelope
(significant regions). Default to "red". Setting the color to |
labels |
A character vector of suitable length.
If |
digits |
The number of digits used for printing the p-value or p-interval in the default main. |
... |
Ignored. |
If several envelopes have been computed, their are plotted in different grey scales so that the smallest envelope has the darkest color and the widest envelope consist of all grey scales with the lightest color in the outskirts.
central_region
, global_envelope_test
if(require("spatstat.explore", quietly=TRUE)) {
X <- unmark(spruces)
nsim <- 1999 # Number of simulations
env <- envelope(X, fun="Kest", nsim=nsim,
savefuns=TRUE, # save the functions
correction="translate", # edge correction for K
simulate=expression(runifpoint(ex=X))) # Simulate CSR
res <- global_envelope_test(env, type="erl")
# Default plot
plot(res)
# Plots can be edited, e.g.
# Remove legend
plot(res) + ggplot2::theme(legend.position="none")
# Change its position
plot(res) + ggplot2::theme(legend.position="right")
# Change the outside color
plot(res, sign.col="#5DC863FF")
plot(res, sign.col=NULL)
# Change default title and x- and y-labels
plot(res) + ggplot2::labs(title="95% global envelope", x="x", y="f(x)")
# Prior to the plot, you can set your preferred ggplot theme by theme_set
old <- ggplot2::theme_set(ggplot2::theme_bw())
plot(res)
# Do other edits, e.g. turn off expansion with the default limits
plot(res) + ggplot2::coord_cartesian(expand=FALSE)
# Go back to the old theme
ggplot2::theme_set(old)
# If you are working with the R package spatstat and its envelope-function,
# you can obtain global envelope plots in the style of spatstat using plot.fv:
plot.fv(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.