ggplot_add_surface: Add surfaces to a ggplot object

View source: R/utility_plotgeometry.R

ggplot_add_surfaceR Documentation

Add surfaces to a ggplot object

Description

Function to make it faster to add a series of soil, water or structure surfaces to an existing ggplot object

Usage

ggplot_add_surface(
  plt,
  df,
  type = "soil",
  colour = NULL,
  fill = NULL,
  linetype = NULL,
  linesize = 0.5,
  linesize_marker = 0.3,
  settings = tibble::tibble(id = c("soil", "water", "structure"), fill = c("#d3bc5f",
    "#2a7fff", "#333333"), colour = c("#65571d", "#000080", "#000000"), linetype = c(1,
    2, 1), pos_marker = c(1/3, 2/3, 1/2), scale_marker = c(0.075, 0.05, 0.05))
)

Arguments

plt

ggplot to be added to

df

tibble with data. Should contain fields 'x' and 'y' for polygon point positions. May contain optional field 'group' to differentiate between different polygons

type

either 'soil', 'water' or 'structure'. This setting is used to determine the fill colour of the polygons

colour

if specied, overrides the colour settings defined through the 'settings' settings

fill

if specified, overrides the fill colour defined through the 'settings' settings

linetype

if specied, overrides the linetype settings defined through the 'settings' settings

linesize

line size thickness

linesize_marker

thickness of lines in surface marker elements

settings

dataframe with default settings for soil, water and structure elements

Value

ggplot object


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