Ir al contenido

This function generates a ternary plot using the ggtern package with customizable axis labels. The function allows specifying the variable names for the x, y, and z axes. It also capitalizes the first letter of each variable name for axis labels.

Uso

ternaryPlot(data, xvar, yvar, zvar, bsize, point_size, ...)

Argumentos

data

A data frame containing the data to be plotted.

xvar

The name of the variable to be plotted in the x-axis of the ternary plot.

yvar

The name of the variable to be plotted in the y-axis of the ternary plot.

zvar

The name of the variable to be plotted in the z-axis of the ternary plot.

bsize

The base font size for the plot.

point_size

The size of the points.

...

others ggplot parameters

Valor

A ggtern plot object displaying the ternary plot.

Detalles

This function creates a ternary plot, where data points are represented by points in a triangular coordinate system. The xvar, yvar, and zvar arguments allow you to specify which variables from the data argument should be used for each axis. The function also capitalizes the first letter of each variable name for use in the axis labels. You can adjust the base font size (bsize) for the plot to control the text size.

Ver también

ggtern for more information on creating ternary plots using ggtern.

Ejemplos

if (FALSE) { # \dontrun{
# Example usage of the custom function with customized variable names
data <- data.frame(
  arena = c(0.4, 0.3, 0.2, 0.1),
  arcilla = c(0.3, 0.4, 0.2, 0.1),
  limo = c(0.3, 0.3, 0.4, 0.1)
)

ternaryPlot(data, xvar = 'arena', yvar = 'arcilla', 
zvar = 'limo')
} # }