ggparcoord {GGally}R Documentation

ggparcoord - A ggplot2 Parallel Coordinate Plot ; A function for plotting static parallel coordinate plots, utilizing the ggplot2 graphics package.

Description

scale is a character string that denotes how to scale the variables in the parallel coordinate plot. Options:

Usage

ggparcoord(data, columns, groupColumn = NULL, scale = "std", scaleSummary = "mean", 
    centerObsID = 1, missing = "exclude", order = columns, showPoints = FALSE, 
    alphaLines = 1, boxplot = FALSE, shadeBox = NULL, mapping = NULL, title = "")

Arguments

data

the dataset to plot

columns

a vector of variables (either names or indices) to be axes in the plot

groupColumn

a single variable to group (color) by

scale

method used to scale the variables (see Details)

scaleSummary

if scale=="center", summary statistic to univariately center each variable by

centerObsID

if scale=="centerObs", row number of case plot should univariately be centered on

missing

method used to handle missing values (see Details)

order

method used to order the axes (see Details)

showPoints

logical operator indicating whether points should be plotted or not

alphaLines

value of alpha scaler for the lines of the parcoord plot

boxplot

logical operator indicating whether or not boxplots should underlay the distribution of each variable

shadeBox

color of underlaying box which extends from the min to the max for each variable (no box is plotted if shadeBox == NULL)

mapping

aes string to pass to ggplot object

title

character string denoting the title of the plot

Details

missing is a character string that denotes how to handle missing missing values. Options:

order is either a vector of indices or a character string that denotes how to order the axes (variables) of the parallel coordinate plot. Options:

Value

ggplot object that if called, will print

Author(s)

Jason Crowley crowley.jason.s@gmail.com, Barret Schloerke schloerke@gmail.com, Di Cook dicook@iastate.edu, Heike Hofmann hofmann@iastate.edu, Hadley Wickham h.wickham@gmail.com

Examples

# use sample of the diamonds data for illustrative purposes
diamonds.samp <- diamonds[sample(1:dim(diamonds)[1], 100), ]

# basic parallel coordinate plot, using default settings
ggparcoord(data = diamonds.samp, columns = c(1, 5:10))

# this time, color by diamond cut
ggparcoord(data = diamonds.samp, columns = c(1, 5:10), groupColumn = 2)

# underlay univariate boxplots, add title, use uniminmax scaling
ggparcoord(data = diamonds.samp, columns = c(1, 5:10), groupColumn = 2, 
    scale = "uniminmax", boxplot = TRUE, title = "Parallel Coord. Plot of Diamonds Data")

# utilize ggplot2 aes to switch to thicker lines
ggparcoord(data = diamonds.samp, columns = c(1, 5:10), groupColumn = 2, 
    title = "Parallel Coord. Plot of Diamonds Data", mapping = aes(size = 1))

# basic parallel coord plot of the msleep data, using 'random' imputation
# and coloring by diet (can also use variable names in the columns and
# groupColumn arguments)
ggparcoord(data = msleep, columns = 6:11, groupColumn = "vore", missing = "random", 
    scale = "uniminmax")

# center each variable by its median, using the default missing value
# handler, 'exclude'
ggparcoord(data = msleep, columns = 6:11, groupColumn = "vore", scale = "center", 
    scaleSummary = "median")

# with the iris data, order the axes by overall class (Species) separation
# using the anyClass option
ggparcoord(data = iris, columns = 1:4, groupColumn = 5, order = "anyClass")

# add points to the plot, add a title, and use an alpha scalar to make the
# lines transparent
ggparcoord(data = iris, columns = 1:4, groupColumn = 5, order = "anyClass", 
    showPoints = TRUE, title = "Parallel Coordinate Plot for the Iris Data", 
    alphaLines = 0.3)

[Package GGally version 0.3.4 Index]