color.plot.data.frame: Plot cases as colored points

View source: R/colour.R

color.plot.data.frameR Documentation

Plot cases as colored points

Description

Like plot and text.plot but colors according to the response variable.

Usage

## S3 method for class 'data.frame'
color.plot(x, z, zlab = NULL, xlab = NULL, ylab = NULL, labels = F, ...)

Arguments

labels

If NULL, cases are plotted as points. If T, cases are plotted as labels, according to rownames.

...

Extra arguments passed to color.plot.default.

data

a data frame.

formula

a formula specifying a response and two predictors from data

Details

Calls color.plot.default with x as the first predictor in data, y as the second predictor, and z as the response. To get a different predictor/response breakdown than the default, use color.plot(formula, x, ...), which is shorthand for color.plot(model.frame(formula, x), ...).

Each case is plotted with a color determined by the response. If the response is a factor, each factor level is in a different color. If the response is numeric, then it is color-coded by assigning each quantile a different color.

Author(s)

Tom Minka

See Also

color.plot.default

Examples


data(iris)
color.plot(iris)
color.plot(Species ~ Petal.Length + Petal.Width, iris)
#color.plot(Species ~ Petal.Length, iris)
#color.plot(Species ~ Petal.Length, iris,jitter=T)
color.plot(iris, col=1)
color.plot(iris, col=c(1,2))

data(state)
x <- data.frame(state.x77)
color.plot(Murder ~ Frost + Illiteracy, x, labels=T, cex=0.5)


paulemms/datamining documentation built on March 1, 2023, 4:01 p.m.