ggplot_add_polygon: Add a series of polygons to a ggplot object

View source: R/utility_plotgeometry.R

ggplot_add_polygonR Documentation

Add a series of polygons to a ggplot object

Description

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

Usage

ggplot_add_polygon(
  plt,
  df,
  type = "soil",
  fill = NULL,
  settings = tibble::tibble(id = c("soil", "saturated", "water", "structure"), fill =
    c("#d3bc5f", "#aebab7", "#2a7fff", "#333333"), colour = c(NA, NA, NA, NA), )
)

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

fill

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

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.