plot_points: Plot a variable on spatial points or a spatial grid using a...

View source: R/General_figure_functions.R

plot_pointsR Documentation

Plot a variable on spatial points or a spatial grid using a color scale.

Description

Plots a variable either as colored points or as a colored raster. plot_sitestat is a wrapper function that dispatches the other functions according to the type of distrib_data.

Usage

plot_points(x, coords, col, shape = NULL, 
  shapefill = "grey",  zlim= NULL,  zoom_to_points = FALSE, 
  pch = 16, bg = par("bg"), legend = TRUE, ...)
plot_grid(x, coords, col, shape = NULL, 
  shapefill = "grey",  shapeborder = NA, zlim = NULL, 
  zoom_to_points = FALSE, legend = TRUE, gridcol, gridlwd, 
  gridsites, overlay_shape = FALSE, 
  colscale = c("equal_interval","quantiles"), legendlabels = NULL, ...)
plot_species(distrib_data, species, col = c("darkgreen", "red"), ...)

Arguments

x

A numerical variable to be plotted using a color scale

coords

A matrix or data.frame with two columns, or an object inheriting from SpatialPoints, of the same length as x

col

The color palette to use for the color scale. Can be given as color names, a vector of hex colors from a call to a color palette (e.g., terrain.colors(64)), or as the name of one of nodiv's internal palettes. Possibillities are "parula", "jet", "blackbody", "HMblueyellow", "HMrainbow", "HMlinear_optimal", "HMoptimal_scale", "cube1", "cubeyf1". Alternatively col can be one of "auto", "ramp", "monochrome", "divergent" or "individual", allowing nodiv to choose a palette of the given type

shape

A shape file giving a map to use as a background for the plot

shapefill

If shape is a polygon, the color to use to fill the polygons. If shape is a line shapefile, the color to use for plotting lines

shapeborder

If shape is a polygon, the color to use for plotting the line border

zlim

The values to use for the extremes of the color scale

zoom_to_points

Given a shapefile, the function will set the outer limits of the plot to the bounding box of the shapefile. If zoom_to_points is TRUE, the outer limits will be set by the bounding box of the data points instead.

pch

The point character to use for plotting points

bg

The central color of points when using a pch value between 21 and 25

distrib_data

An object of type distrib_data, nodiv_data or nodiv_result to use for plotting x.

legend

Whether to plot a color legend

species

The number or name of the species to be plotted

gridcol

If specified, plots the sampling grid cell borders in this color

gridlwd

If specified, set the line width of overlaid grid cell borders

gridsites

If specified, which grid cells to draw cell borders around

overlay_shape

Whether to overlay the shape file border on top of the points - only works if shape is a vector shapefile

colscale

Specifies whether to define the colors on an equal interval or a quantile-based color scale

legendlabels

Specifies custom labels for the colorbar legend

...

Additional arguments to pass to plot

Details

Note that if shape is a raster object, the points may shift relative to the background when resizing the image. This seems to be due to a bug in the raster package.

Author(s)

Michael Krabbe Borregaard


mkborregaard/nodiv documentation built on April 7, 2023, 9:52 a.m.