# NOT RUN {
# }
# NOT RUN {
if(require(aqp) &
require(sp) &
require(soilDB)
) {
# sample data
data("mineralKing", package = "soilDB")
# quick overview
par(mar=c(1,1,2,1))
groupedProfilePlot(mineralKing, groups='taxonname', print.id=FALSE)
# init coords and CRS
coordinates(mineralKing) <- ~ x_std + y_std
proj4string(mineralKing) <- '+proj=longlat +datum=NAD83'
# projected CRS, units of meters
crs.utm <- CRS('+proj=utm +zone=11 +datum=NAD83')
# adjust margins
par(mar=c(4.5,4,4,1))
# standard transect plot, profile sketches arranged along integer sequence
plotTransect(mineralKing, grad.var.name='elev_field', crs=crs.utm,
grad.axis.title='Elevation (m)', label='pedon_id', name='hzname')
# default behavior, attempt adjustments to prevent over-plot and preserve relative spacing
# use set.seed() to fix outcome
plotTransect(mineralKing, grad.var.name='elev_field', crs=crs.utm,
grad.axis.title='Elevation (m)', label='pedon_id',
name='hzname', width=0.15, spacing = 'relative')
# attempt relative positioning based on scaled distances, no corrections for overlap
# profiles are clustered in space and therefore over-plot
plotTransect(mineralKing, grad.var.name='elev_field', crs=crs.utm,
grad.axis.title='Elevation (m)', label='pedon_id', name='hzname',
width=0.15, spacing = 'relative', fix.relative.pos = FALSE)
# customize arguments to aqp::fixOverlap()
plotTransect(mineralKing, grad.var.name='elev_field', crs=crs.utm,
grad.axis.title='Elevation (m)', label='pedon_id', name='hzname',
width=0.15, spacing = 'relative',
fix.relative.pos = list(maxIter=6000, adj=0.2, thresh=0.7))
plotTransect(mineralKing, grad.var.name='elev_field', crs=crs.utm,
grad.axis.title='Elevation (m)', label='pedon_id', name='hzname',
width=0.2, spacing = 'relative',
fix.relative.pos = list(maxIter=6000, adj=0.2, thresh=0.6),
name.style = 'center-center')
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab