Draw a 2D interpretation of a mesh object, or a mesh-alike object. This is very fast and can be used to created approximately continuously varying surface plots.

mesh_plot(
  x,
  col = NULL,
  add = FALSE,
  zlim = NULL,
  ...,
  coords = NULL,
  crs = NULL
)

# S3 method for mesh3d
mesh_plot(
  x,
  col = NULL,
  add = FALSE,
  zlim = NULL,
  ...,
  coords = NULL,
  crs = NULL
)

# S3 method for BasicRaster
mesh_plot(
  x,
  col = NULL,
  add = FALSE,
  zlim = NULL,
  ...,
  coords = NULL,
  crs = NULL
)

# S3 method for sc
mesh_plot(
  x,
  col = NULL,
  add = FALSE,
  zlim = NULL,
  ...,
  coords = NULL,
  crs = NULL
)

# S3 method for default
mesh_plot(
  x,
  col = NULL,
  add = FALSE,
  zlim = NULL,
  ...,
  coords = NULL,
  crs = NULL
)

# S3 method for triangulation
mesh_plot(
  x,
  col = NULL,
  add = FALSE,
  zlim = NULL,
  ...,
  coords = NULL,
  crs = NULL
)

Arguments

x

object to convert to mesh and plot

col

colours to use, defaults to that used by graphics::image()

add

add to existing plot or start a new one

zlim

absolute range of data to use for colour scaling (if NULL the data range is used)

...

passed through to base::plot

coords

optional input raster of coordinates of each cell, see details

crs

target map projection

Value

nothing, used for the side-effect of creating or adding to a plot

Details

The input is treated as a mesh and plotted in vectorized form using 'grid'.

The mesh may be reprojected prior to plotting using the 'crs' argument to define the target map projection in 'PROJ string' format. (There is no "reproject" function for quadmesh, this is performed directly on the x-y coordinates of the 'quadmesh' output). The 'col' argument are mapped to the inputdata as in graphics::image(), and applied relative to 'zlim' if also supplied.

The coords argument only applies to a raster object. The crs argument only applies to a spatial object that has a crs projection metadata string understood by anglr (works, but still work in progress). There is a change from the previous quadmesh::mesh_plot() function that requires both crs and coords to be named. In quadmesh, crs was the second argument to the mesh_plot() function and so in usage was normally not named.

If coords is supplied, it is currently assumed to be a 2-layer RasterBrick with longitude and latitude as the cell values. These are used to geographically locate the resulting mesh, and will be transformed to the crs if that is supplied. This is modelled on the approach to curvilinear grid data used in the angstroms package. There the function angstroms::romsmap() and `angstroms::romscoords()`` are used to separate the complicated grid geometry from the grid data itself.