Learn R Programming

soiltexture (version 1.2.9)

TT.plot: Plot soil texture triangles / diagrams.

Description

Plot a soil texture triangle (also called soil texture diagrams, or soil texture ternary plots), with or without background soil texture classes boundaries, and with or without soil texture data points. The triangle geometry depends on the soil texture classification system chosen ('class.sys' argument) or on 'forcing' parameters (see below). Both the boundaries of the background texture classification system and the texture data points can be transformed from one particle size limits system to another (the particle size limits system of the plot). Default behaviour is no transformation (set 'css.transf' argument to TRUE to allow transformation). There are 3 different way to set the triangle geometry and characteristics (1) setting the 'class.sys' argument [lowest priority], (2) changing one or several values of the 'geo' list of arguments or (3) setting the corresponding arguments of TT.plot() [highest priority]. These arguments are "blr.clock", "tlr.an", "blr.tx", "text.sum", and "base.css.ps.lim". Different geometry arguments can be set at different levels (1, 2 or 3). Case (1) should be used when one wants to use the 'default' triangle geometry associated with a given texture classification system (chosen with the 'class.sys' argument). Case (2) should be used when TT.plot() has been called previously, with a call like geo <- TT.plot(), so the 'geo' object returned can be used for setting the geometry of a new texture triangle TT.plot( geo = geo ) identical to the previous one. Case (3) should be used whenever the user wants to set the geometry of a texture triangle plot different from default values of the texture classification system chosen, and without re-using the geometry from a previous plot. ON DEFAULT VALUES OF TT.plot() ARGUMENTS? As TT.plot() shares its arguments with many other functions, their default value is not defined in TT.plot() source code, but rather in a dedicated list object called 'TT.par' and stored in the environment TT.env. The function TT.get() is used to retrieve the default value of the arguments defined in TT.par (see ?TT.get). For instance, to know the default value of 'class.sys', you can type TT.get("class.sys"). To set a different default value for a given argument in R, use TT.set() (see ?TT.set). For instance to change the default value of 'class.sys', type TT.set( "class.sys" = "USDA.TT" ).

Usage

TT.plot(geo = NULL,

tri.data = NULL,

add = FALSE,

css.names = NULL,

z.name = NULL,

main = NULL,

blr.tx = NULL,

css.lab = NULL,

text.sum = NULL,

base.css.ps.lim = NULL,

tri.css.ps.lim = NULL,

dat.css.ps.lim = NULL,

css.transf = NULL,

text.transf.fun = NULL,

trsf.add.opt1 = NULL,

trsf.add.opt2 = NULL,

unit.ps = NULL,

unit.tx = NULL,

blr.clock = NULL,

tlr.an = NULL,

font = NULL,

font.axis = NULL,

font.lab = NULL,

font.main = NULL,

bg = NULL,

fg = NULL,

col = NULL,

col.axis = NULL,

col.lab = NULL,

col.main = NULL,

cex = NULL,

cex.axis = NULL,

cex.lab = NULL,

cex.main = NULL,

lwd = NULL,

lwd.axis = NULL,

lwd.lab = NULL,

family.op = NULL,

frame.bg.col = NULL,

at = NULL,

grid.show = NULL,

grid.col = NULL,

grid.lty = NULL,

class.sys = NULL,

class.lab.show = NULL,

class.lab.col = NULL,

class.line.col = NULL,

class.p.bg.col = NULL,

class.p.bg.hue = NULL,

arrows.show = NULL,

arrows.lty = NULL,

points.type = NULL,

pch = NULL,

z.type = NULL,

z.col.hue = NULL,

z.cex.range = NULL,

z.pch = NULL,

text.tol = NULL,

tri.sum.tst = NULL,

tri.pos.tst = NULL,

b.lim = NULL,

l.lim = NULL,

lang = NULL,

new.mar = NULL,

new.centroid = TRUE)

Arguments

geo
List. 'geo' is one of the 3 way to set the texture triangle geometry. See there description and hierarchy in the function description. If geo != NULL, then geo must be a list containing 1 or several of the following items: "blr.clock", "tlr.an
tri.data
Data frame. Data frame containing the CLAY, SILT and SAND 'coordinates' of the texture data points to be plotted on top of the texture triangle and texture class boundaries. The data frame can contain more column than needed (ignored). The data
add
Single logical. If FALSE, a new plot is created. If FALSE, the plot is added to the existing one.
css.names
Vector of 3 character strings. Name of the columns in 'tri.data' that contains the CLAY SILT and SAND values, respectively. If NULL, default c("CLAY","SILT","SAND") value is assumed. Not to be confused with 'css.lab' that defines the labels of th
z.name
Single character string. Name of the column in 'tri.data' that contains the '4th quantitative variable' whose value must be used to define the points expansion factor and color (bubble plot). If NULL, a simple plot is drawn (no 'bubbles')
main
Single character string or expression. Main title of the plot.
blr.tx
Vector of 3 character strings. The 1st, 2nd and 3rd values must be either CLAY, SILT or SAND, and determines the particle size classes associated with the BOTTOM, LEFT and RIGHT axis, respectively. CLAY, SILT and SAND order in the vector is free,
css.lab
Vector of 3 character strings or 3 expressions. The 1st, 2nd and 3rd values must be text strings or expressions, and determines the axes plot labels for the CLAY, SILT and SAND particle size classes, respectively. 'css.lab' values are independent
text.sum
Single numerical. Sum of the 3 particle size classes for each texture value (fixed). The real sum of the 3 particle size classes in 'tri.data' should be >= text.sum * (1-text.tol) OR
base.css.ps.lim
Vector of 4 numericals. Particle size boundaries (upper and lower) of the 3 particle size classes (CLAY, SILT and SAND, starting from the lower size of CLAY particles, 0, to the upper size of the SAND particles, 2000), in micrometers, FOR THE BAS
tri.css.ps.lim
Vector of 4 numericals. Particle size boundaries (upper and lower) of the 3 particle size classes (CLAY, SILT and SAND, starting from the lower size of CLAY particles, 0, to the upper size of the SAND particles, 2000), in micrometers, FOR THE TEX
dat.css.ps.lim
Vector of 4 numericals. Particle size boundaries (upper and lower) of the 3 particle size classes (CLAY, SILT and SAND, starting from the lower size of CLAY particles, 0, to the upper size of the SAND particles, 2000), in micrometers, FOR THE TEX
css.transf
Single logical. Set to TRUE to transform the texture coordinates of the texture triangle ('class.sys') or the texture data ('tri.data') into the base particle size class limits. See 'base.css.ps.lim' for the base plot particle size class limits,
text.transf.fun
R function with the same argument names and same output as the function TT.text.transf(). 'text.transf.fun' is the function that transform the texture values from one system of particle class size limits to another. Only used if css.transf == TRU
trsf.add.opt1
Non pre-defined format. If the user specifies its own texture transformation function in 'text.transf.fun' (not TT.text.transf()), then he can use 'trsf.add.opt1' and 'trsf.add.opt1' as new, additional, argument for his function. So the format of
trsf.add.opt2
Non pre-defined format. If the user specifies its own texture transformation function in 'text.transf.fun' (not TT.text.transf()), then he can use 'trsf.add.opt1' and 'trsf.add.opt1' as new, additional, argument for his function. So the format of
unit.ps
Single text string or expression. Unit of particle size class limits displayed on the plot (= part of the axis labels). Does not affect the other calculations. Default micrometers.
unit.tx
Single text string or expression. Unit of particle texture values displayed on the plot (= part of the axis labels). Does not affect the other calculations. Default is percentage.
blr.clock
Vector of logicals, eventually with NA values. Direction of increasing texture values on the BOTTOM, LEFT and RIGHT axis, respectively. A value of TRUE means that the axis direction is clockwise. A value of FALSE means that the axis direction is
tlr.an
Vector of numericals. Value - in degrees - of the TOP, LEFT and RIGHT angles of the triangle. Any value between 0 and 90 is possible, but values belonging to 0 or 45 or 60 or 90 give a better graphical rendering.
font
Single integer. Not used yet.
font.axis
Single integer. Same definition as par("font.axis"). Font of the triangle axis's numbering.
font.lab
Single integer. Same definition as par("font.lab"). Font of the triangle axis's labels.
font.main
Single integer. Same definition as par("font.main"). Font of the triangle main title.
bg
Text string containing an R color code. Background color of the plot (= outside the triangle). See 'frame.bg.col' for the background color inside the triangle frame.
fg
Text string containing an R color code. DEPRECATED. foreground color of the plot (= point fill color).
col
Text string containing an R color code. Same definition as par("col"). Color of the points plotted in the triangle.
col.axis
Text string containing an R color code. Color of the triangle's axis (line and tics) The color of the texture classes boundaries is set by 'class.line.col'.
col.lab
Text string containing an R color code. Color of the triangle's labels (text) and arrows. The color of the texture classes labels is set by 'class.lab.col'.
col.main
Text string containing an R color code. Color of the main title.
cex
Vector of numerical or single numerical. Same definition as par("cex"). Expansion factor for the points plotted on the triangle.
cex.axis
Single numerical. Same definition as par("cex.axis"). Expansion factor for the axis tics labels (numbering).
cex.lab
Single numerical. Same definition as par("cex.lab"). Expansion factor for the axis labels AND the texture classes labels.
cex.main
Single numerical. Same definition as par("cex.main"). Expansion factor for the main title.
lwd
Single numerical. Same definition as par("lwd"). Line width for the graphical elements inside the triangle (points plotted).
lwd.axis
Single numerical. Same definition as par("lwd.axis"). Line width for the axis lines, tics and the grid lines inside the triangle.
lwd.lab
Single numerical. Same definition as par("lwd"). Line width for the direction arrows.
family.op
Single text string. Same definition as par("family"). Font type to be used in the plot text elements (title, labels)
frame.bg.col
Text string containing an R color code. Background color of the triangle plot (= inside the triangle). See 'bg' for the background color outside the triangle frame.
at
Vector of numericals. Location of the grid line start points on all 3 triangles axis. At the moment values are identical for all 3 axis, and changes to that parameter have not been tested.
grid.show
Single logical. If set to TRUE (the default) a grid is drawn on the background of the texture triangle. Set to FALSE to remove the grid.
grid.col
Text string containing an R color code. Color of the grid lines. If equal to NULL, then an appropriate color is used. Appropriate means (i) if 'class.p.bg.col' is FALSE (no color gradient in texture class polygons), then grid.col is equal to 'bg'
grid.lty
Single numerical. Line type of the grid lines (same types as par("lty")).
class.sys
Single text string. Text code of the texture classification system to be plotted on the background of the texture triangle. That texture classification system will determines the triangle geometry and particle class size system of the plot, unles
class.lab.show
Single text string. If equal to "abr" (default) or "full", labels are drawn inside texture class polygons with their full name ("full") or abbreviated name ("abr"). If equal to "none", no label is drawn.
class.lab.col
Text string containing an R color code. Color of the text label drawn inside texture class polygons.
class.line.col
Text string containing an R color code. Color of the texture class polygon boundary lines.
class.p.bg.col
Single logical OR vector of R colors (character strings). If FALSE (the default), no color gradient is used inside the texture class polygons. If TRUE, a color gradient is drawn, with the color hue specified in 'class.p.bg.hue' and with satura
class.p.bg.hue
Single numerical. Only used if class.p.bg.col == TRUE (no default). Color hue (between 0 and 1) used to create a color gradient between the different texture class polygons.
arrows.show
Single logical. If TRUE (default), 3 arrows are drawn outside the triangle, along each axis, that show the direction of increasing values (arrow base) and of isovalue (arrow tip) of the texture class. If FALSE no arrows are drawn.
arrows.lty
Single numerical. Line type of the arrows drawn outside the triangle, along each axis. Same possible types as par("lty").
points.type
Single text letter. Point type. Either "p" (points only), "l" (lines only) or "b" (both points and lines), as for plot() or points(). Point refer here to soil texture values plotted on the triangle.
pch
Single numerical or vector of numericals, or single text string or vector of text string. Point shape number(s) or point character(s) to be plotted. Point refer here to soil texture values plotted on the triangle.
z.type
Single character string. Type of plot to be used for displaying a 4th variable on the texture triangle (in addition to Clay, Silt and Sand). Only used if 'z.name' is not NULL. Currently only one value is supported, "bubble", for displaying a bubb
z.col.hue
Single numerical. Hue of the bubble color ([0-1]) to be used if 'z.name' is not NULL. A gradient of saturation and value is automatically created for the bubbles (with this hue).
z.cex.range
Vector of 2 numericals. Minimum and maximum 'cex' of the bubbles plotted on the triangle if 'z.name' is not NULL.
z.pch
Single numerical or vector of numericals. Point symbol number(s) to be used for the bubbles if 'z.name' is not NULL.
text.tol
Single numerical. Tolerance on the sum of the 3 particle size classes. The real sum of the 3 particle size classes in 'tri.data' should be >= text.sum * (1-text.tol) OR
tri.sum.tst
Single logical. If TRUE (the default), the sum of the 3 texture classes of each texture value in 'tri.data' will be checked in regard to 'text.sum' and 'text.tol'. If FALSE, no test is done.
tri.pos.tst
Single logical. If TRUE (the default), the position of texture values in 'tri.data' are tested to check that they are not OUTSIDE the texture triangle (i.e. that some texture values may be negative).
b.lim
Vector of 2 numerical values. This is an equivalent to plot() xlim argument. Minimum and maximum x / bottom value of the texture triangle area, in FRACTION OF THE MAXIMAL EXTENSION. Default is c(0,1). The real span is then b.lim * text.sum. Th
l.lim
Vector of 2 numerical values. This is an equivalent to plot() ylim argument. Minimum and maximum y / left value of the texture triangle area, in FRACTION OF THE MAXIMAL EXTENSION. Default is c(0,1). The real span is then l.lim * text.sum. This
lang
Single text string. Determines the language used for the plot main title and axis labels. Possible values are 'en' (English, the default), "fr" (French), "it" (Italian), "es" (Spanish), "de" (German), "nl" (Dutch), "se" (Swedish) and "fl" (Flemis
new.mar
Vector of 4 numericals. Margin sizes of the plot. Default is the same as par("mar"). See par("mar") for more details. Use this at your own risks!
new.centroid
Single logical. If TRUE (default) the new method (Paul Bourke) is used to calculate the centroid. If FALSE the centroid is taken as the mean x and y coordinates of the vertices.

Examples

Run this code
require( soiltexture ) 



# ::: Texture triangles without data



# :: Base plot (FAO triangle) 

TT.plot() 



# same as

TT.plot( class.sys = "FAO50.TT" ) 



# :: Same plot, but with USDA texture triangle 

TT.plot( class.sys = "USDA.TT" ) 



# :: Same plot, but with a color gradient 

TT.plot( 

    class.sys       = "USDA.TT", 

    class.p.bg.col  = TRUE

)   #



# :: No texture classification system

TT.plot( class.sys = "none" ) 



# ::: Texture triangles with texture data 



# :: 1st create a dummy texture dataset 

my.text <- data.frame( 

    "CLAY"  = c(05,60,15,05,25,05,25,45,65,75,13,47), 

    "SILT"  = c(05,08,15,25,55,85,65,45,15,15,17,43), 

    "SAND"  = c(90,32,70,70,20,10,10,10,20,10,70,10), 

    "OC"    = c(20,14,15,05,12,15,07,21,25,30,05,28)  

)   #



# :: And plot it on a French Aisne texture triangle

#    with a title

TT.plot( 

    class.sys   = "FR.AISNE.TT", 

    tri.data    = my.text, 

    main        = "Soil texture data" 

)   #



# ::: Bubble plots (4th variable) 



# :: 1st generate a dummy texture dataset with a 4th variable 

#    with TT.dataset() 

rand.text   <- TT.dataset( n = 100, seed.val = 1980042401 ) 



# :: Plot the dummy dataset as a bubble plot

TT.plot( 

    class.sys   = "none", 

    tri.data    = rand.text, 

    z.name      = "Z", 

    main        = "Soil texture triangle and Z bubble plot" 

)   #



# ::: Test all the texture triangles



TT.plot( class.sys = "none" )           # no classification 

TT.plot( class.sys = "FAO50.TT" )       # FAO 

TT.plot( class.sys = "USDA.TT" )        # USDA 

TT.plot( class.sys = "FR.AISNE.TT" )    # French Aisne 

TT.plot( class.sys = "FR.GEPPA.TT" )    # French GEPPA 

TT.plot( class.sys = "DE.BK94.TT" )     # Germany 

TT.plot( class.sys = "UK.SSEW.TT" )     # UK 

TT.plot( class.sys = "BE.TT" )          # Belgium 

TT.plot( class.sys = "CA.FR.TT" )       # Canada (fr) 

TT.plot( class.sys = "CA.EN.TT" )       # Canada (en) 

TT.plot( class.sys = "AU.TT" )          # Australian 

TT.plot( class.sys = "ISSS.TT" )        # ISSS 

TT.plot( class.sys = "ROM.TT" )         # Romanian 

TT.plot( class.sys = "PL.TT" )          # Polish 

TT.plot( class.sys = "DE.SEA74.TT" )    # German SEA 1974 

TT.plot( class.sys = "DE.TGL85.TT" )    # German TGL 1985 





# ::: Test all the languages:



TT.plot( class.sys = "USDA.TT", lang = "en" )  #  English, default 

TT.plot( class.sys = "USDA.TT", lang = "fr" )  #  French 

TT.plot( class.sys = "USDA.TT", lang = "de" )  #  German 

TT.plot( class.sys = "USDA.TT", lang = "es" )  #  Spanish 

TT.plot( class.sys = "USDA.TT", lang = "it" )  #  Italian 

TT.plot( class.sys = "USDA.TT", lang = "nl" )  #  Dutch 

TT.plot( class.sys = "USDA.TT", lang = "fl" )  #  Dutch (Belgian) / Flemmish 

TT.plot( class.sys = "USDA.TT", lang = "se" )  #  Swedish 

TT.plot( class.sys = "USDA.TT", lang = "ro" )  #  Romanian 

TT.plot( class.sys = "USDA.TT", lang = "pl" )  #  Polish

Run the code above in your browser using DataLab