mesh_plot: Plot a mesh surface in 2D

Description Usage Arguments Details Value

View source: R/mesh_plot.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
mesh_plot(
  x,
  col = NULL,
  add = FALSE,
  zlim = NULL,
  ...,
  coords = NULL,
  crs = NULL
)

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

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

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

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

## S3 method for class '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

unimplemented (was used in 'quadmesh::mesh_plot')

...

passed through to base::plot

coords

optional input raster of coordinates of each cell, see details

crs

target map projection

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().

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.

Value

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


anglr documentation built on July 29, 2020, 9:06 a.m.