Learn R Programming

soilprofile (version 1.0)

plot_profile: The function which is called from the generic 'plot.profile.data.frame'

Description

This is the core function for plotting soil profile field data

Usage

plot_profile(data, bottom = NULL, names = TRUE, names.col = "white",
background = "munsell", plot.roots = TRUE, plot.skeletal = TRUE,
random = TRUE, existing_data = NULL, horizon.border = NA, order = FALSE,
width = 480, element = FALSE, element.col = "black", element.legend =
FALSE, element.lims = FALSE, element.lab = FALSE, element.type = "b",
element.pch = 1, element.lty = 1, xax.log = FALSE, legend.labs = FALSE,
legend.pos = "bottom")

Arguments

data
An object of class 'profile.data.frame' as generated by the 'build.profile' function.
bottom
A positive numeric value which controls the lower boundary of the plot. If not provided it defaults to the lower limit of the profile, or the lower limit of the deepest profile in case of multiple profiles.
names
A logical value indicating whether the name of the horizons should be plotted (the default) or not in the soil profile.
names.col
The color of the horizon names.
background
The color background for the horizons. If background='munsell' (the defaul), color is determined by a call to the 'munsell_to_rgb' function. See the function for details on the conversion.
plot.roots
A logical value indicating whether the roots should be plotted or not.
plot.skeletal
A logical value indicating whether the skeletal should be plotted or not.
random
A logical value indicating whether data for plotting elements (roots and skeletal) in the profile shuold be randomly generated or not. It defaults to TRUE and is required to be TRUE when you plot a profile for the first time. If you assign thi
existing_data
If random=FALSE, this is a complex list of elements for drawing the same soil profile(s) previously generated. See examples.
horizon.border
A color string. The default is NA, so that no horizon border is plotted.
order
A vector of names that match the profile names in your dataset. This is used for multiple profile plots. The default is alphabetical order, so if you want a customized order use this argument.
width
An integer value ranging approximately 150-1400. This number defaults to 480. It controls the 'layout' of multiple panels in a single figure. The default is optimized for plotting 3-4 profiles in a single figure. Lower widths are required for
element
A character vector of one ore more parameters (chemical elements, etc.) to be plotted within the profile. Names must match colnames of your data. It defaults to FALSE, no element is plotted.
element.col
A character vector of colors for plotting elements.
element.legend
A logical value for plotting the legend.
element.lims
As for 'xlims' in plot, to set a unique limit for multiple elements in plot.
element.lab
A label for the x axis if element!=FALSE
element.type
One between 'n', 'b', 'l' as for 'plot', to define line type for element(s)
element.pch
As in 'pch' for 'plot'.
element.lty
As in 'lty', for 'plot'.
xax.log
A logical value for logaritmic x axis
legend.labs
if element.legend=TRUE, provide labs for legend
legend.pos
Defaults to 'bottom'. The location may be specified by setting a single keyword from the list 'bottomright', 'bottom', 'bottomleft', 'left', 'topleft', 'top', 'topright', 'right' and 'center' as in 'legend'. However, the legend position defau

Value

  • A complex list of all numeric values used in the plot are returned invisibly. The function can be however assigned for plotting the same soil profile more than once. See arguments 'random' and 'existing_data' for more details.

Details

This function is the core of the package and is written for plotting basic soil properties usually gathered in the field in a semi-quantitative way, for consistent representation of soil profile sketches. Those sketches are common in soil science publications and provide immediate feeling of what a given profile, or even better a sequence of soils look like morphologically. This function makes it possible to draw such profiles in few seconds and in a semi-quantitative way. Horizon boundaries are drawn according to the given depths. Irregular boundaries in the form of e.g. '0-12/23' cm are allowed, where it is ment that the lower boundary of such horizon fluctuates between 12 and 23 cm. Stones (i.e. soil skeletal) are plotted within a soil horizon in three different shapes ('channer', 'subangular', 'subcircle'), in whatever dimension expressed in cm, and with the abundance provided between 0 and 1. Abundance is computed exactly on an area basis for each horizon. Roots are drawn following the same approach as skeletal, except that root abundance is provided qualitatively, as it is a common practice in soil profile description. The color of a given horizon may be an RGB color that exactly reproduces the munsell color of the soil horizon.

See Also

'eplot', 'build.profile', 'depths'

Examples

Run this code
## basic plot, assigned to an object
tmp2 <- plot(example)

## a different plot (data for plotting are randomly generated each time,
## unless you assign and recycle it, like in following examples)
plot(example)

## use existing_data and random=FALSE to get the same plot (if assigned)
 
plot(example, random=FALSE, existing_data=example.data)

## esclude roots and skeletal from a plot

plot(example, random=FALSE, existing_data=example.data, plot.roots=FALSE,
plot.skeletal=FALSE)

## a compex plot with an element added to the basic soil structure and a
## legend, and an overview of options

plot(example, random=FALSE, existing_data=example.data, horizon.border='blue',
width=500, plot.roots=FALSE, plot.skeletal=FALSE, element='Corg',
element.lim=c(0, 27), element.col='black', names=FALSE, background='white',
element.lab='Organic carbon (percent)', element.legend=TRUE,
legend.labs='TOC')

## an optimal plotting with its graphical device, note the use of width
## both in the device and within the plot.
png('myprofile.png', height=800, width=1200, pointsize=28)
plot(example, random=FALSE, existing_data=example.data, horizon.border='blue',
width=1200, plot.roots=FALSE, plot.skeletal=FALSE, element='Corg',
element.lim=c(0, 27), element.col='black', names=FALSE, background='white',
element.lab='Organic carbon (percent)', element.legend=TRUE,
legend.labs='TOC')
dev.off()

Run the code above in your browser using DataLab