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
)
object to convert to mesh and plot
colours to use, defaults to that used by graphics::image()
add to existing plot or start a new one
unimplemented (was used in 'quadmesh::mesh_plot')
passed through to base::plot
optional input raster of coordinates of each cell, see details
target map projection
nothing, used for the side-effect of creating or adding to a plot
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()
.
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.
If the input is a mesh3d and has a material texture image this is approximated
by averaging the RGB values of each primitive's corner into a constant colour
for that face. If you would like to avoid this texture colour, set the
'mesh3d$material$color' property to NULL
.