ggplot_add_watermarker: Annotate water table marker to a ggplot object

View source: R/utility_plotgeometry.R

ggplot_add_watermarkerR Documentation

Annotate water table marker to a ggplot object

Description

Adds a standard water table marker (upside-down triangle over a number of horizontal lines) to an existing ggplot

Usage

ggplot_add_watermarker(
  plt,
  xc,
  yc,
  theta = 0,
  scale = 1,
  linesize = 0.5,
  fill_water = "#2a7fff",
  colour_water = "#000080"
)

Arguments

plt

ggplot object

xc, yc

x and y-position where marker touches water table

theta

rotation angle (in case label needs to be rotated, in rad)

scale

scaling factor for marker. Default height is approx 1

linesize

thickness of lines

fill_water

fill colour for triangle

colour_water

line colour for all lines

Value

ggplot object with added water table marker

Examples

#generate simple plot
plt <- ggplot2::ggplot() +
  ggplot2::annotate("rect", xmin = -2, xmax = 2, ymin = -2, ymax = 2, fill = "yellow") +
  ggplot2::coord_fixed(ratio = 1)

#add water table marker
ggplot_add_watermarker(plt, x = 1, y = 1, scale = 1, theta = 0.4)

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