Skip to contents

Draws the points of a make_prediction_grid() grid as filled squares on a ggOceanMaps::basemap(), approximating the actual grid cells. Optionally colours the squares by a column (depth by default, when present).

Usage

# S3 method for class 'sdmTMB_prediction_grid'
plot(
  x,
  value = "depth",
  crs = NULL,
  xy_cols = c("X", "Y"),
  coord_multiplier = NULL,
  point_size = NULL,
  palette = "turbo",
  color = "red",
  base_size = 11,
  ...
)

Arguments

x

A data frame from make_prediction_grid() (class sdmTMB_prediction_grid).

value

Character. Column in x used to colour the points, e.g. "depth" (the default). If NULL, or not a column of x, points are drawn in a single color.

crs

Coordinate reference system. If NULL (default), taken from the crs attribute set by make_prediction_grid().

xy_cols

Character vector of the coordinate columns. Default c("X", "Y").

coord_multiplier

Numeric factor to convert coordinates to CRS units. If NULL (default), taken from the coord_multiplier attribute set by make_prediction_grid() (falling back to 1000).

point_size

Numeric size of the grid-cell squares. If NULL (default), scaled from the resolution attribute set by make_prediction_grid() (0.08 * resolution, falling back to 1 if unavailable) so squares roughly approximate the actual cell size.

palette

Character. viridis palette used when colouring by value, passed to option in ggplot2::scale_color_viridis_c(). Default "turbo".

color

Character. Point colour used when not colouring by value. Default "red".

base_size

Numeric. Base font size. Default 11.

Value

A ggplot object.

Author

Mikko Vihtakari

Examples

# \donttest{
data(sebastes)
eggan <- subset(sebastes, cruiseseries == "EggaN")
region <- make_survey_prediction_region(eggan, crs = 32633, concavity = 5)
grid <- make_prediction_grid(region, resolution = 20, max_depth = 1000)
plot(grid)

plot(grid, palette = "viridis")

# }