| ggproctor | R Documentation |
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.
ggproctor( df, identifier = sample_name, annotate = TRUE, sat_100 = TRUE, sat_90 = TRUE, ... )
df |
data frame containing water contents and dry densities |
identifier |
unquoted column name which distinguishes the samples from each other, defaults to |
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 |
experimental
a 'gg' plot object
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.