ggproctor: Plot one or more compaction curves

View source: R/ggproctor.R

ggproctorR Documentation

Plot one or more compaction curves

Description

Fits a compaction curve using a natural cubic spline and returns a ggplot2 plot. The maximum dry density and optimum water content can be annotated on the plot and the user may specify whether the 90% and 100% satration curves should be drawn. Faceting and the addition of other ggplot layers are supported.

Usage

ggproctor(
  df,
  identifier = sample_name,
  annotate = TRUE,
  sat_100 = TRUE,
  sat_90 = TRUE,
  ...
)

Arguments

df

data frame containing water contents and dry densities

identifier

unquoted column name which distinguishes the samples from each other, defaults to sample_name

annotate

whether to print the values of maximum density and optimum water content on the plot

sat_100

display the 100% saturation line (temperature of 22 °^C^ assumed)

sat_90

display the 90% saturation line (temperature of 22 °^C^ assumed)

...

other arguments passed on to geom_smooth and geom_point()

Details

\lifecycle

experimental

Value

a 'gg' plot object

Examples

# compute raw density values
library(ggplot2)
library(dplyr)

compaction_data <- soiltestr::example_proctor_data %>%
  soiltestr::add_physical_properties()

# a single sample
standard_data <- filter(compaction_data, compaction_effort == "standard")
ggproctor(standard_data, identifier = compaction_effort)

# two samples on same plot; annotations turned off
ggproctor(compaction_data, identifier = compaction_effort, annotate = FALSE)

# facet and leave data annotations on but turn off 90% saturation line
ggproctor(compaction_data, identifier = compaction_effort, sat_90 = FALSE)+
  facet_wrap(~compaction_effort)

# change color of both curves to the same value
ggproctor(compaction_data, sat_90 = FALSE,
           identifier = compaction_effort, color = 'darkgreen')+
  facet_wrap(~compaction_effort)

evanmascitti/soiltestr documentation built on Oct. 6, 2022, 5:32 p.m.