Learn R Programming

aqp (version 2.2)

aggregateColorPlot: Plot aggregate soil color data

Description

Generate a plot from summaries generated by aggregateColor().

Usage

aggregateColorPlot(
  x,
  print.label = TRUE,
  label.font = 1,
  label.cex = 0.65,
  label.orientation = c("v", "h"),
  buffer.pct = 0.02,
  print.n.hz = FALSE,
  rect.border = "black",
  horizontal.borders = FALSE,
  horizontal.border.lwd = 2,
  x.axis = TRUE,
  y.axis = TRUE,
  ...
)

Value

no data are returned, function is called for graphical output

Arguments

x

a list, results from aggregateColor()

print.label

logical, print Munsell color labels inside of rectangles, only if they fit

label.font

font specification for color labels

label.cex

font size for color labels

label.orientation

label orientation, v for vertical or h for horizontal

buffer.pct

extra space between labels and color rectangles

print.n.hz

optionally print the number of horizons below Munsell color labels

rect.border

color for rectangle border

horizontal.borders

optionally add horizontal borders between bands of color

horizontal.border.lwd

line width for horizontal borders

x.axis

logical, add a scale and label to x-axis?

y.axis

logical, add group labels to y-axis?

...

additional arguments passed to plot

Author

D.E. Beaudette

Details

See the related tutorial for additional examples.

Examples

Run this code

# keep examples from using more than 2 cores
data.table::setDTthreads(Sys.getenv("OMP_THREAD_LIMIT", unset = 2))

# load some example data
data(sp1, package = 'aqp')

# upgrade to SoilProfileCollection and convert Munsell colors
sp1$soil_color <- with(sp1, munsell2rgb(hue, value, chroma))
depths(sp1) <- id ~ top + bottom
site(sp1) <- ~ group

# generalize horizon names
n <- c('O', 'A', 'B', 'C')
p <- c('O', 'A', 'B', 'C')
sp1$genhz <- generalize.hz(sp1$name, n, p)

# aggregate colors over horizon-level attribute: 'genhz'
a <- aggregateColor(sp1, groups = 'genhz', col = 'soil_color')

# check results
str(a)

# simple visualization
aggregateColorPlot(a)

Run the code above in your browser using DataLab