Skip to content

Instantly share code, notes, and snippets.

@aaronwolen
aaronwolen / ggpairs.r
Last active May 25, 2016 13:12
Modified version of the ggplot2 plotmatrix function that accepts additional variables for aesthetic mapping.
#' Modified version of the ggplot2 plotmatrix function that accepts additional
#' variables for aesthetic mapping.
#'
#' example
#' data(iris)
#' iris.vars <- c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")
#' ggpairs(data = iris, facet.vars = iris.vars,
#' mapping = aes(color = Species, shape = Species))
ggpairs <- function (data, facet.vars = colnames(data), facet.scale = "free",