Learn R Programming

tabplot (version 0.11-2)

tableChange: Change a tabplot-object

Description

Change the order of columns, flip, and change the palettes of a tabplot-object.

Usage

tableChange(tab,
    colNames = sapply(tab$columns, function(col) col$name),
    flip = FALSE, pals = list(), colorNA = NULL,
    numPals = NULL)

Arguments

colNames
vector of names of the desired columns
flip
logical, if TRUE then the plot is flipped vertically, i.e. the row bins are reversed
pals
list of color palettes. Each list item is on of the following:
  • a palette name intablePalettes, optionally with the starting color between brackets.
  • a palette vector
colorNA
color for missing values
numPals
name(s) of the palette(s) that is(are) used for numeric variables ("Blues", "Greys", or "Greens"). Recycled if necessary.

Value

Examples

Run this code
# load diamonds dataset from ggplot2
require(ggplot2)
data(diamonds)

# assign tableplot as tabplot object
tab <- tableplot(diamonds, plot=FALSE)
 
# modify the tabplot object: reverse order of columns and customize palette
tab <- tableChange(tab, colNames=names(diamonds[1:7]), pals=list("Set4", "Set3", gray(seq(0,1,length.out=8))))
 
# plot modified tabplot object
plot(tab)

Run the code above in your browser using DataLab