rmf_plot.rmf_2d_array plots a MODFLOW 2D array.

# S3 method for rmf_2d_array
rmf_plot(
  array,
  dis,
  bas = NULL,
  mask = rmfi_ifelse0(is.null(bas), array * 0 + 1, {     if (dis$nlay > 1)         
    warning("Using first ibound layer as mask.", call. = FALSE)    
    rmfi_ifelse0(bas$xsection, aperm(bas$ibound, c(3, 2, 1))[, , 1], bas$ibound[, , 1])
    }),
  colour_palette = ifelse(type %in% c("contour", "vector"), "black",
    rmfi_rev_rainbow),
  zlim = range(array[as.logical(mask)], finite = TRUE),
  nlevels = 7,
  type = "fill",
  levels = NULL,
  gridlines = FALSE,
  add = FALSE,
  height_exaggeration = 100,
  binwidth = max(pretty(diff(zlim)/20, 2)),
  label = TRUE,
  prj = rmf_get_prj(dis),
  crs = NULL,
  alpha = 1,
  plot3d = FALSE,
  height = NULL,
  crop = FALSE,
  vecsize = NULL,
  uvw = NULL,
  legend = ifelse(type %in% c("fill", "factor"), !add, FALSE),
  ...
)

Arguments

array

an object of class rmf_2d_array

dis

discretization file object

bas

basic file object; optional

mask

a 2D array with 0 or F indicating inactive cells; optional; defaults to having all cells active or, if bas is provided, the first layer of bas$ibound

colour_palette

a colour palette for imaging continuous array values. If type = 'contour' or 'vector', a single character can also be used.

zlim

vector of minimum and maximum value for the colour scale

nlevels

number of levels for the colour scale; defaults to 7

type

plot type: 'fill' (default), 'factor', 'grid', 'contour' or 'vector'

levels

(named) character vector with labels for the factor legend. If not named, factor levels are sorted before being labelled. If NULL, the array factor levels are used

gridlines

logical; should grid lines be plotted? alternatively, provide colour of the grid lines.

add

logical; if TRUE, provide ggplot2 layers instead of object, or add 3D plot to existing rgl device; defaults to FALSE

height_exaggeration

height exaggeration for 3D plot; optional

binwidth

binwidth for contour plot; defaults to 1/20 of zlim

label

logical; should labels be added to contour plot

prj

projection file object

crs

coordinate reference system for the plot

alpha

transparency value; defaults to 1

plot3d

logical; should a 3D plot be made

height

2D array for specifying the 3D plot z coordinate

crop

logical; should plot be cropped by dropping NA values (as set by mask); defaults to FALSE

vecsize

vector sizing if type = 'vector'. See ggquiver::geom_quiver. Defaults to NULL which automatically determines vector sizing.

uvw

optional named list with u and v vectors or 2d arrays specifying the vector components in the x and y direction for every node if type = 'vector'. By default, these components are computed by rmf_gradient

legend

either a logical indicating if the legend is shown or a character indicating the legend title

...

ignored

Value

ggplot2 object or layer; if plot3D is TRUE, nothing is returned and the plot is made directly

Details

type = 'vector' assumes the array contains scalars and will calculate the gradient using rmf_gradient unless uvw is specified. For types 'fill' and 'factor', the fill aesthetic is used. For types 'contour' and 'vector', the colour aesthetic is used.