Learn R Programming

soilprofile (version 1.0)

eplot: A lattice-based plot of elements on multiple panels

Description

This function is used for plotting depth functions of given elements in one or more soil profile(s)

Usage

eplot(data, element, panel = NULL, groups = NULL, ...)

Arguments

data
An object of class 'profile.data.frame'
element
A string giving the element as in colum name of data
panel
A vector of grouping factor for the conditioning variables (which define the subsets plotted in different panels) to be used in the plot. If NULL it defaults to the column named Profile, and plots elements as defined in 'element' subsetted
groups
An additional subgroup which controls colors of the elements plotted in each panel.
...
Other arguments as in 'xyplot' function in package 'lattice'.

Value

  • The high-level functions documented here, as well as other high-level Lattice functions, return an object of class 'trellis'. See ?xyplot for more details.

Details

This function plots element in 'element' according to the subsetting provided in 'panel', and 'groups'. It is provided to rapidly obtain a depth function of a given variable, subsetted by profile in case of multiple-profile datasets.

See Also

plot.profile.data.frame

Examples

Run this code
## plot of organic C depth functions in 5 profiles
eplot(example, 'Corg', col='black', type='b', main='Example',
             xlab='Organic C (percent)', ylab='Depth')

## different colors according to different soil profiles
eplot(example, 'Corg', type='b', main='Example',
             xlab='Organic C (%)', ylab='Depth', groups=example$Profile,
             panel=1, col=palette()[1:4])
## an example to add a legend with trellis (lattice) commands
    trellis.focus("toplevel") ## has coordinate system [0,1] x [0,1]
  panel.text(0.65, 0.63, "Site", cex = 0.8, font = 2, pos=4)
  panel.text(0.65, 0.59, "P1", cex = 0.8, pos=4)
  panel.text(0.65, 0.56, "SG2", cex = 0.8, pos=4, col=palette()[2])
  panel.text(0.65, 0.53, "SG5", cex = 0.8, pos=4, col=palette()[3])
  panel.text(0.65, 0.50, "SG7", cex = 0.8, pos=4, col=palette()[4])
  trellis.unfocus()

Run the code above in your browser using DataLab