Learn R Programming

ICtest (version 0.3-5)

ggplot.ladle: Scatterplot Matrix for a ladle Object using ggplot2

Description

For an object of class ladle, plots either the pairwise scatter plot matrix using ggpairs from GGally, or the time series plots of the underlying components using ggplot2. The user can choose if only the components considered interesting or all of them should be plotted. Aesthetics can be passed to ggpairs as well.

Usage

# S3 method for ladle
ggplot(data, mapping = aes(), mapvar = NULL, which = "all", ..., 
       environment=parent.frame())

Arguments

data

object of class ladle

mapping

aesthetic mapping, see documentation for ggpairs. If x has the class mts then this argument is not used.

mapvar

data.frame of the external variables used by the aesthetic mappings. If x has the class mts then this argument is not used.

which

if "all", then all components of S in the ladle object are plotted. If "k", then only the first k components are plotted, where the value of k is taken from the ladle object. This is only meaningful if k was at least 2.

...

arguments passed on to ggpairs. If the component matrix has the class mts, xts or zoo then this argument is not used.

environment

not used but needed for consistency.

Details

If the component matrix has the class mts, xts or zoo then a time series plot will be plotted using ggplot2. Otherwise, a pairwise scatter plot matrix will be plotted using GGally.

See Also

plot.ladle, pairs

Examples

Run this code
# NOT RUN {
# The data
X <- as.matrix(iris[, 1:4])

# The aesthetics variables
mapvar <- data.frame(iris[, 5])
colnames(mapvar) <- "species"

ladle_res <- PCAladle(X)

# The estimate
summary(ladle_res)

# Plots of the components
ggplot(ladle_res)
ggplot(ladle_res, aes(color = species), mapvar = mapvar, which = "k")
# }

Run the code above in your browser using DataLab