rmf_plot.rmf_3d_array plots a 2D section through a MODFLOW 3D array.

# S3 method for rmf_3d_array
rmf_plot(
  array,
  dis,
  i = NULL,
  j = NULL,
  k = NULL,
  bas = NULL,
  mask = rmfi_ifelse0(is.null(bas), array * 0 + 1, rmfi_ifelse0(bas$xsection,
    aperm(bas$ibound, c(3, 2, 1)), bas$ibound)),
  zlim = range(array[rmfi_ifelse0(is.null(i), c(1:dim(array)[1]), i),
    rmfi_ifelse0(is.null(j), c(1:dim(array)[2]), j), rmfi_ifelse0(is.null(k),
    c(1:dim(array)[3]), k)][as.logical(mask[rmfi_ifelse0(is.null(i), c(1:dim(array)[1]),
    i), rmfi_ifelse0(is.null(j), c(1:dim(array)[2]), j), rmfi_ifelse0(is.null(k),
    c(1:dim(array)[3]), k)])], finite = TRUE),
  colour_palette = ifelse(type %in% c("contour", "vector"), "black",
    rmfi_rev_rainbow),
  nlevels = 7,
  type = "fill",
  levels = NULL,
  gridlines = FALSE,
  add = FALSE,
  crop = FALSE,
  hed = NULL,
  l = NULL,
  binwidth = max(pretty(diff(zlim)/20, 2)),
  label = TRUE,
  prj = rmf_get_prj(dis),
  crs = NULL,
  vecsize = NULL,
  uvw = NULL,
  legend = ifelse(type %in% c("fill", "factor"), !add, FALSE),
  ...
)

Arguments

array

an object of class rmf_3d_array

dis

discretization file object

i

row number to plot

j

column number to plot

k

layer number to plot

bas

basic file object; optional

mask

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

zlim

vector of minimum and maximum value for the colour scale

colour_palette

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

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 values 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.

crop

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

hed

hed object for only plotting the saturated part of the grid; possibly subsetted with time step number; by default, last time step is used

l

time step number for subsetting the hed object

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

vecsize

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

uvw

optional named list with u, v and w vectors or 3d arrays specifying the vector components in the x, y and z 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

...

parameters provided to plot.rmf_2d_array

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.