color.plot | R Documentation |
Like plot
and text.plot
but colors according to
a third variable.
color.plot(object, ...)
x, y |
numeric vectors of the same length. |
z |
a numeric vector or factor, same length as |
labels |
a character vector of labels, same length as |
axes |
If FALSE, no axes are plotted (but there may still be a key). |
key |
If FALSE, no key is plotted. |
add |
If FALSE, a new plot is made. If TRUE, points or labels are added to the existing plot. |
nlevels |
an integer. If |
color.palette |
a vector of colors, arbitrary length, or a function
with integer argument which generates a vector of colors (e.g.
|
col |
a vector of colors, as in a call to |
pch.palette |
a vector of plotting symbols, arbitrary length. If
|
pch |
a vector of plotting symbols, as in a call to |
digits |
the number of digits to use in the color key when |
bg |
the background color |
mar |
figure margins (see |
Each (x,y) point is plotted with a color determined by z
. If
z
is a factor, each factor level is in a different color. If
z
is numeric, then it is color-coded by assigning each quantile a
different color.
Despite the name, this function can also make plots using different symbols
instead of colors. For example, if color.palette=1
then all points
will be black but use different symbols.
When labels != NULL
, the result is equivalent to
text.plot
with colors.
If key=TRUE
and there is more than one color or symbol on the plot, a
key is displayed at the top of the figure.
A plot is produced.
This function sets the figure margins permanently, so that you can
draw on the color plot. Unfortunately, this also means future plots will
use the same margins, until you change them with par("mar")
.
Tom Minka
color.plot.data.frame
,color.plot.loess
,color.plot.glm
,color.plot.knn
,color.plot.tree
,YlGnBu.colors
# See the examples for color.plot.data.frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.