sl.plot.field.elem: Plot Field on Triangular Elements

sl.plot.field.elemR Documentation

Plot Field on Triangular Elements

Description

Plot a 2-dimensional numerical field on a triangular grid, where values are given at the nodes (vertices), by averaging the vertex triplets and filling the triangular elements.

Usage

sl.plot.field.elem(plot.init.res, num, lon, lat, elem, fill = TRUE, col.fill = "colbar", border = TRUE, col.border = "colbar", colbar = sl.colbar.redgreyblue_256, colbar.breaks = NA, colbar.breaks.log = FALSE, border.lwd = 1, border.lty = 1, na.col = NA)

Arguments

plot.init.res

a spheRlab plot specifics list as returned by sl.plot.init (or a variant thereof).

num

a vector of length N specifying a 2-dimensional numerical (unstructured) field, with values valid at the nodes (triangle vertices).

lon

a vector of length N specifying the node longitudes.

lat

a vector of length N specifying the node latitudes.

elem

an Nex3 matrix providing the vertex indices of each triangular element spanned by the nodes in num. Note that Ne ~= 2xN.

fill

a logical value indicating whether the elements (triangles) shall be filled.

col.fill

the fill colour. If col.fill="colbar" (default), the colourbar and breaks defined in colbar and colbar.breaks are used.

border

a logical value indicating whether or not to draw lines for the polygon borders. Default is TRUE, which can avoid aliasing that may occur when plots are rendered. If aliasing still occurs, you can try to increase border.lwd.

col.border

the colour of the borders. If col.border="colbar" (default), then borders are coloured according to the field (node/polygon) values. This generates minute graphical overlap that prevents aliasing by artefacts ("fractures") between polygons in the plot.

colbar

a spheRlab colourbar (as returned by sl.colbar) of length Nc to be used for the field.

colbar.breaks

a numeric vector of length Nc-1 specifying the breaks between colours.

colbar.breaks.log

a logical value indicating whether colourbar breaks are to be placed logarithmically.

border.lwd

the line width of the borders. Default is 1. Used only if border=TRUE. If this is used to avoid aliasing when plots are rendered, but aliasing still occurs, you can try to increase this value.

border.lty

the line type of the borders (edges).

na.col

the color to be used for NA values. Default is na.col=NA, meaning that no polygons are drawn where num=NA.

Details

The function uses sl.plot.field internally.

Value

If a colourbar is used, it will be returned for further usage (e.g., for plotting of the colourbar).

Note

Unfortunately, R does not seem to have the capability to draw genuine colour gradients (as Matlab and Python do). If that capability is added at some point (or found to already exist), it should be added as an option to this function.

Note that, instead of using this function with fill=FALSE, one should use sl.plot.elem where edges are drawn only once.

Author(s)

Helge Goessling

See Also

sl.plot.field, sl.plot.elem

Examples

## To be provided ...

FESOM/spheRlab documentation built on April 6, 2024, 6:52 p.m.