Learn R Programming

statisR (version 1.0.1)

plot.statis.dual.trajectories: Plot Variable Trajectories in STATIS DUAL

Description

Visualizes the evolution of one or more variables across the different tables in a STATIS DUAL analysis. Each trajectory represents the sequence of positions of a variable in the compromise space.

Usage

# S3 method for statis.dual.trajectories
plot(
  vars,
  trajectories,
  labels.tables,
  .range = NULL,
  style.line = list(linetype = 2, linewidth = 0.5, color = "orange"),
  point.size = 3,
  base.colors = c("red", "blue", "brown", "darkgreen", "purple", "orange", "cyan4",
    "gold3", "black")
)

Value

A ggplot object showing the trajectories of the selected variables.

Arguments

vars

Vector of variable names to plot (must match the names in trajectories).

trajectories

List generated by statis.dual()$trajectories, where each element is a K x 2 matrix.

labels.tables

Vector of length K with the names or labels of the tables.

.range

List with axis limits: list(x = c(xmin, xmax), y = c(ymin, ymax)). If NULL, limits are computed automatically.

style.line

List with line style for the trajectories.

point.size

Size of the points at each position along the trajectory.

base.colors

Vector of base colors to distinguish the variables.

See Also

plot.statis.dual.circle, statis.dual

Examples

Run this code
data(Tuis5_95, Tuis5_96, Tuis5_97, Tuis5_98)
labels = c("95","96","97","98")

res <- statis.dual(list(Tuis5_95, Tuis5_96, Tuis5_97, Tuis5_98), labels.tables = labels)

# If you want to select some variables
vars.A <- c("Ph","ST","NO3")
t <- ggplot2::ggtitle(sprintf("Trayectorias (%s)", paste(vars.A, collapse = ", ")))

plot.statis.dual.trajectories(vars.A, res$trajectories, res$labels.tables) + t

# If you want to select an specific variable
vars.1 <- "Temp"
t <- ggplot2::ggtitle(sprintf("Trajectory (%s)", vars.1))

plot.statis.dual.trajectories(vars.1, res$trajectories, res$labels.tables) + t

# All variables
t <- ggplot2::ggtitle("Trajectories (all variables)")
plot.statis.dual.trajectories(res$vars.names, res$trajectories, res$labels.tables) + t

Run the code above in your browser using DataLab