Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addVolumeFraction() should use smaller vertical grid when horizon thickness is very small #316

Open
dylanbeaudette opened this issue Jun 11, 2024 · 0 comments

Comments

@dylanbeaudette
Copy link
Member

dylanbeaudette commented Jun 11, 2024

library(soilDB)
library(aqp)
library(lattice)

# Bandy Ranch sites data - take HQ pasture site to work in study data
f <- fetchLDM(c('22N0011'), what = "pedlabsampnum")  

plotSPC(f, name.style = 'center-center', color = 'clay_total', id.style = 'side', raggedBottom = FALSE, label = 'corr_taxsubgrp')
addVolumeFraction(f, colname = "total_frag_wt_pct_gt_2_mm_ws", pch = 5)

# replicate the same profile for plotting
d <- duplicate(f, times=5)
# add treatment ID for labels
d$ID <- c('Initial application', 'No trampling, 20 t/ha', 'No trampling, 40 t/ha', 'Trampling, 20 t/ha', 'Trampling, 40 t/ha')

# tinker with margins / y-offset
par(mar = c(0, 2, 0, 3))
plotSPC(d, name.style = 'center-center', id.style = 'side', label = 'ID', max.depth = 25, width = 0.33)

# add column for biochar fraction
horizons(d)$biochar_content <- rep(95, 5) 

# trunc() is vectorized
# best to use integer depths
# now specified as mm
f <- trunc(
  d, 
  z1 = c(0, 3.0, 4.0, 4.5, 7.4), 
  z2 = c(3.0, 4.0, 4.5, 7.4, 9.0)
)

# be sure to set the max depth in mm
par(mar = c(0, 1, 0, 3))
plotSPC(d, name.style = 'center-center', id.style = 'side', label = 'ID', max.depth = 25.0, width = 0.33, cex.names = 1)


addVolumeFraction(f, colname = "total_frag_wt_pct_gt_2_mm_ws", pch = 16, res = 20, cex.min = 0.5, cex.max = 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant