ggplot_add_hydraulichead: ggplot 2D map of hydraulic heads and pressures

View source: R/flownet_plotting.R

ggplot_add_hydraulicheadR Documentation

ggplot 2D map of hydraulic heads and pressures

Description

Plots a 2D map of the pressure or head distributions in a flow net problem. The plot shows both a heat map and contour lines. Can be added to an existing ggplot if required

Usage

ggplot_add_hydraulichead(
  df,
  dp,
  di = NULL,
  type = "h",
  linewidth = 0.5,
  colour_contour = "black",
  binwidth = 0.25,
  gamma_w = 10,
  label_size = 3,
  label_n = 1,
  palette = "Blues",
  palette_direction = 1,
  legend_position = "right",
  plt = NULL,
  xlab = "x [m]",
  ylab = "z [m]",
  xlim = c(NA, NA),
  ylim = c(NA, NA),
  axes = TRUE
)

Arguments

df

tibble with domains/problem description

dp

flow net solution tibble

di

flow net solution rectangular interpolation tibble. This tibble is used for plotting contour lines (flow lines and equipotential lines). If the grid is rectangular, this is simply equal to 'dp'. If not, an interpolation function is used. If not defined, it is calculated from 'dp'

type

parameter to plot. 'type = "h"' for hydraulic heads, 'type = "hz"' for elevation head, 'type = 'hb' for pressure head or 'type = "u"' for pore water pressures

linewidth

contour line thickness

colour_contour

colour of contour lines

binwidth

contour line distance

gamma_w

unit weight of water, in kN/m3 (required for calculating pore water pressures)

label_size

contour line text label size

label_n

number of times contour label appears on each line

palette

RColorBrewer color map for shading

palette_direction

RColorBrewer color map direction ('1' or '-1')

legend_position

position of the legend for colours. use 'legend_position = "none"' to disable the legend

plt

a ggplot object. If not defined, a new plot is generated

xlab

x and y-axis label - if 'plt' not defined

ylab

x and y-axis label - if 'plt' not defined

xlim

user-defined axis limits - if 'plt' not defined

ylim

user-defined axis limits - if 'plt' not defined

axes

if 'FALSE' no axes are plotted - if 'plt' not defined

Value

a ggplot object

Examples

#rectangular flow net
df <- flownet_geometry_rectangular()
dp <- flownet_solve_rectangular(df)
#plot heads
ggplot_add_hydraulichead(
  df,
  dp,
  type = "h",
  binwidth = 0.25
)
#plot elevation head
ggplot_add_hydraulichead(
  df,
  dp = dp,
  type = "hz",
  binwidth = 2.5
)
#plot pressure head
ggplot_add_hydraulichead(
  df,
  dp = dp,
  type = "hb",
  binwidth = 2.5
)
#plot pore water pressure
ggplot_add_hydraulichead(
  df,
  dp = dp,
  type = "u",
  binwidth = 25
)

#quadrilateral flow net
df <- flownet_geometry_quadrilateral()
dp <- flownet_solve_quadrilateral(df)
#plot heads
ggplot_add_hydraulichead(
  df,
  dp,
  type = "h",
  binwidth = 0.5
)

GJMeijer/soilmech documentation built on May 22, 2022, 10:39 a.m.