color.plot.data.frame | R Documentation |
Like plot
and text.plot
but colors according to
the response variable.
## S3 method for class 'data.frame' color.plot(x, z, zlab = NULL, xlab = NULL, ylab = NULL, labels = F, ...)
labels |
If NULL, cases are plotted as points. If T, cases are plotted
as labels, according to |
... |
Extra arguments passed to |
data |
a data frame. |
formula |
a formula specifying a response and two predictors from
|
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.
Tom Minka
color.plot.default
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.