MAPI_Plot2: Function MAPI_Plot2

Description Usage Arguments Value Examples

View source: R/MAPI_Plot2.R

Description

Plot a MAPI analysis result with ggplot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
MAPI_Plot2(
  resu,
  tails = NULL,
  samples = NULL,
  pal = c("#994000", "#CC5800", "#FF8F33", "#FFAD66", "#FFCA99", "#FFE6CC", "#FBFBFB",
    "#CCFDFF", "#99F8FF", "#66F0FF", "#33E4FF", "#00AACC", "#007A99"),
  shades = 20,
  main = "",
  upper = TRUE,
  lower = TRUE,
  upper.border = "black",
  lower.border = "gray"
)

Arguments

resu

A spatial object of class 'sf' resulting from a MAPI analysis done using MAPI_RunAuto or MAPI_RunOnGrid.

tails

An optional spatial object of class 'sf' resulting from the post-process with MAPI_Tails of a MAPI analysis result. Default = NULL (no tails shown).

samples

A data.frame with names and geographical coordinates of samples. Column names must be: 'ind', 'x', 'y'. Optional column 'errRad' with an error radius for sample locations (eg. GPS uncertainty). Coordinates must be projected (not latitude/longitude).

pal

A color ramp, eg. from RColorBrewer (default: orange > light gray > blue)

shades

Number of breaks for the color ramp (default 20)

main

Plot title (none by default)

upper

If TRUE and tails is not NULL, upper-tail significant areas are plotted. TRUE by default.

lower

If TRUE and tails is not NULL, lower-tail significant areas are plotted. TRUE by default.

upper.border

Border color of the upper-tail significant area. "black" by default.

lower.border

Border color of the lower-tail significant area. "gray" by default.

Value

Returns the ggplot object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(ggplot2)
data("metric")
data("samples")
resu <- MAPI_RunAuto(samples, metric, crs=3857, nbPermuts = 1000)
tails <- MAPI_Tails(resu)
pl <- MAPI_Plot2(resu, tails=tails, samples=samples)
# Save to image
ggsave("mapiPlotOutput.png", plot=pl)

## End(Not run)

mapi documentation built on Jan. 19, 2022, 5:06 p.m.