View source: R/utility_plotgeometry.R
ggplot_add_polygon | R Documentation |
Function to make it faster to add a series of soil, water or structure polygons to an existing ggplot object
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), ) )
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 |
ggplot object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.