plot_profile: The function which is called from the generic...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plot_profile.R

Description

This is the core function for plotting soil profile field data

Usage

1
2
3
4
5
6
7
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 this first plot to an object, you can use such object in the following argument ('existing_data') to draw the same profile you have generated previously. Since the shapes are by default randomly generated, you can run 'plot.profile.data.frame' more than once until you get the soil profile representation you like most. Remember to always assign a plot to an object so that you can retrieve it. See examples for details.

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 lower number of profiles and the other way around. Optimal width of plots is achieved by using the same width as argument of the plot function and as argument for width of your favorite graphical device. See examples.

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 defaults to bottom and is optimized for beeing set in the panel with the shallower profile. So 'bottom' will work in most cases.

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.

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.

Author(s)

Gianluca Filippa

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## basic plot, assigned to an object
## Not run: 
tmp2 <- plot(example)

## End(Not run)

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

## End(Not run)

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

## End(Not run)

## esclude roots and skeletal from a plot

## Not run: 
plot(example, random=FALSE, existing_data=example.data, plot.roots=FALSE,
plot.skeletal=FALSE)

## End(Not run)

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

## Not run: 
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')

## End(Not run)

## an optimal plotting with its graphical device, note the use of width
## both in the device and within the plot.
## Not run: 
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()

## End(Not run)

soilprofile documentation built on May 29, 2017, 10:50 p.m.