This function plots sampling frames, design sites, and analysis data. If the left-hand side of the formula is empty, plots are of the distributions of the right-hand side variables. If the left-hand side of the variable contains a variable, plots are of the left-hand size variable for each level of each right-hand side variable. This function is largely built on plot.sf(), and all spsurvey plotting methods can supply additional arguments to plot.sf(). For more information on plotting in sf, run ?sf::plot.sf(). Equivalent to sp_plot(); both are currently maintained for backwards compatibility.

# S3 method for sp_frame
plot(
  x,
  formula = ~1,
  xcoord,
  ycoord,
  crs,
  var_args = NULL,
  varlevel_args = NULL,
  geom = FALSE,
  onlyshow = NULL,
  fix_bbox = TRUE,
  ...
)

# S3 method for sp_design
plot(
  x,
  sframe = NULL,
  formula = ~siteuse,
  siteuse = NULL,
  var_args = NULL,
  varlevel_args = NULL,
  geom = FALSE,
  onlyshow = NULL,
  fix_bbox = TRUE,
  ...
)

Arguments

x

An object to plot. When plotting sampling frames an sf object given the appropriate class using sp_frame. When plotting design sites, an object created by grts() or irs() (which has class sp_design). When plotting analysis data, a data frame or an sf object given the appropriate class using sp_frame.

formula

A formula. One-sided formulas are used to summarize the distribution of numeric or categorical variables. For one-sided formulas, variable names are placed to the right of ~ (a right-hand side variable). Two sided formulas are used to summarize the distribution of a left-hand side variable for each level of each right-hand side categorical variable in the formula. Note that only for two-sided formulas are numeric right-hand side variables coerced to a categorical variables. If an intercept is included as a right-hand side variable (whether the formula is one-sided or two-sided), the total will also be summarized. When plotting sampling frames or analysis data, the default formula is ~ 1. When plotting design sites, siteuse should be used in the formula, and the default formula is ~ siteuse.

xcoord

Name of the x-coordinate (east-west) in object (only required if object is not an sf object).

ycoord

Name of y (north-south)-coordinate in object (only required if object is not an sf object).

crs

Projection code for xcoord and ycoord (only required if object is not an sf object).

var_args

A named list. The name of each list element corresponds to a right-hand side variable in formula. Values in the list are composed of graphical arguments that are to be passed to every level of the variable. To see all graphical arguments available, run ?plot.sf.

varlevel_args

A named list. The name of each list element corresponds to a right-hand side variable in formula. The first element in this list should be "levels" and contain all levels of the particular right-hand side variable. Subsequent names correspond to graphical arguments that are to be passed to the specified levels (in order) of the right-hand side variable. Values for each graphical argument must be specified for each level of the right-hand side variable, but applicable sf defaults will be matched by inputting the value NA. To see all graphical arguments available, run ?plot.sf

geom

Should separate geometries for each level of the right-hand side formula variables be plotted? Defaults to FALSE.

onlyshow

A string indicating the single level of the single right-hand side variable for which a summary is requested. This argument is only used when a single right-hand side variable is provided.

fix_bbox

Should the geometry bounding box be fixed across plots? If a length-four vector with names "xmin", "ymin", "xmax", and "ymax" and values indicating bounding box edges, the bounding box will be fixed as fix_bbox across plots. If TRUE, the bounding box will be fixed across plots as the bounding box of object. If FALSE, the bounding box will vary across plots according to the unique geometry for each plot. Defaults to TRUE.

...

Additional arguments to pass to plot.sf().

sframe

The sampling frame (an sf object) to plot alongside design sites. This argument is only used when object corresponds to the design sites.

siteuse

A character vector of site types to include when plotting design sites. It can only take on values "sframe" (sampling frame), "Legacy" (for legacy sites), "Base" (for base sites), "Over" (for n_over replacement sites), and "Near" (for n_near replacement sites). The order of sites represents the layering in the plot (e.g. siteuse = c("Base", "Legacy") will plot legacy sites on top of base sites. Defaults to all non-NULL elements in x and y with plot order "sframe", "Legacy", "Base", "Over", "Near".

Author

Michael Dumelle Dumelle.Michael@epa.gov

Examples

if (FALSE) {
data("NE_Lakes")
NE_Lakes <- sp_frame(NE_Lakes)
plot(NE_Lakes, formula = ~ELEV_CAT)
sample <- grts(NE_Lakes, 30)
plot(sample, NE_Lakes)
}