La textura del suelo es una de las propiedades más importantes cuando caracterizamos suelos. En este tutorial vamos a representar arena, limo y arcilla como porcentajes en un diagrama terciario.
Soil texture is one of the most important properties when we are describing soils. In this tutorial we are going to represent sand, silt and clay as percentages in a terciary plot.
Comenzamos cargando las siguientes librerias. Para instalar las librerias debes correr en tu consola:
Let's start loading the required packages. For package installation, you must run in your console:
install.packages("soiltexture","ggtern","ggplot2")
library(soiltexture)
library(ggtern)
library(ggplot2)
Creamos un data.frame con datos de arena, limo y arcilla, agregando materia orgánica (OM)
Let's create a data.frame including sand, silt and clay, adding organic matter (OM)
soils <- data.frame(SAND = c(20,30,40,50,70,10,10),
SILT = c(5,15,20,25,20,50,70),
CLAY = c(75,55,40,25,10,40,20),
OM = c(2,3,2,5,4,10,4))
Usando la funcion TT.plot más nuestro dataset podemos graficar directamente
Using the function TT.plot, the dataset can be plotted directly
TT.plot(class.sys = "USDA.TT", # Clases texturales según la USDA / USDA textural classes
tri.data = soils # Nuestro dataset / our dataset
)
No se ve muy claro, pero podemos personalizar el gráfico cambiando los ejes, etiquetas, etc. Tambien podemos agregar una cuarta variable.
It does not seem very clear, but we can customize the plot changing the axis, labels, etc. Also we can include a 4th variable.
TT.plot(class.sys = "USDA.TT",
tri.data = soils,
main = "USDA", # Título / title
cex.axis = 0.5, # Expansion factor for axis / Factor de expansión para los ejes
cex.lab = 0.5, # Expansion factor for labels / Factor de expansión para las etiquetas
col = "green", # Color for points / Color de los puntos
z.name = "OM" #Cuarta variable /4th variable
)
Si estamos familiarizados con la libreria ggplot2, podemos también hace un triángulo de texturas. Ggplot2 nos deja personalizar las escalas de colores fácilmente
If we know how to use the ggplot2 package, we can also plot a soil triangule. Ggplot2 allows to customize the color scales easily.
theme_set(theme_bw()) #simple ggplot theme / tema de ggplot simple
ggtern(data=soils,aes(x=SAND,y=CLAY,z=SILT,color=OM)) +
geom_point(size=5) + # tamaño de los puntos / point size
labs(yarrow="Clay(%)", # etiqueta de las fechas / arrow label
zarrow="Silt(%)",
xarrow="Sand(%)") +
theme_showarrows() + # mostrar flechas / display arrows
scale_colour_gradient(low = "yellow",# escala de color / color scale
high = "red") +
theme_clockwise() # orientacion de las flechas / arrow orientation /
Espero que este corto tutorial les sirva para comenzar a graficar sus texturas de forma más facil =). Sara
I hope this short tutorial helps you to plot your textural data easily =). Sara