From dad4b7003eed5c6c6773da5bc53f5b34359dd19a Mon Sep 17 00:00:00 2001 From: Beaudette Date: Wed, 16 Oct 2024 13:56:25 -0700 Subject: [PATCH] minor updates --- R/addVolumeFraction.R | 6 +++--- man/addVolumeFraction.Rd | 3 +++ misc/sandbox/morphologic-grid/2024-reboot.R | 12 +++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/R/addVolumeFraction.R b/R/addVolumeFraction.R index 39e5e29f..8820d0fb 100644 --- a/R/addVolumeFraction.R +++ b/R/addVolumeFraction.R @@ -51,6 +51,8 @@ #' @title Symbolize Volume Fraction within a Soil Profile Collection Plot #' #' @description Symbolize volume fraction on an existing soil profile collection plot. +#' +#' @note It may be necessary to adjust both `res`, `cex.min`, and `cex.max` for optimal legibility. #' #' @param x a `SoilProfileCollection` object #' @param colname character vector of length 1, naming the column containing volume fraction data (horizon-level attribute). Values should be within 0-100 percent. @@ -68,9 +70,7 @@ #' #' @export #' - - -## TODO: symbol size must be controlled by `res` +#' addVolumeFraction <- function(x, colname, res = 10, cex.min = 0.1, cex.max = 0.5, pch = 1, col = 'black') { # color should be either: diff --git a/man/addVolumeFraction.Rd b/man/addVolumeFraction.Rd index 5169230b..a3aa79c3 100644 --- a/man/addVolumeFraction.Rd +++ b/man/addVolumeFraction.Rd @@ -35,6 +35,9 @@ Symbolize volume fraction on an existing soil profile collection plot. \details{ This function can only be called after plotting a \code{SoilProfileCollection} object. Details associated with a call to \code{plotSPC()} are automatically accounted for within this function: e.g. \code{plot.order}, \code{width}, etc.. } +\note{ +It may be necessary to adjust both \code{res}, \code{cex.min}, and \code{cex.max} for optimal legibility. +} \seealso{ \code{\link[=plotSPC]{plotSPC()}} } diff --git a/misc/sandbox/morphologic-grid/2024-reboot.R b/misc/sandbox/morphologic-grid/2024-reboot.R index 71fe4a59..63478021 100644 --- a/misc/sandbox/morphologic-grid/2024-reboot.R +++ b/misc/sandbox/morphologic-grid/2024-reboot.R @@ -179,8 +179,13 @@ library(aqp) # plot: graphical sanity check on results initHzDepthFunctions <- function(hz, plot = TRUE) { + # number of horizons + n <- nrow(hz) + + # plot colors + # generate a depth function for each horizon template - p <- lapply(seq_along(1:nrow(hz)), function(i) { + p <- lapply(1:n, function(i) { zapsmall( # work at depth interval mid points dnorm(z.i + (dz / 2), mean = hz$m[i], sd = hz$sd[i]) @@ -202,7 +207,8 @@ initHzDepthFunctions <- function(hz, plot = TRUE) { x = z.i, y = pp, type = 'b', - pch = 1, + pch = 1, + lwd = 1.5, cex = 0.5, xlab = 'Depth (cm)', ylab = 'Pr(H | depth)', @@ -330,7 +336,7 @@ p <- initHzDepthFunctions(hz) ## simulation -n.profiles <- 8 +n.profiles <- 10 pIDs <- sprintf("p%02d", 1:n.profiles) s <- lapply(1:n.profiles, function(i) {