color.plot {mining} | R Documentation |
Like plot
and text.plot
but colors according to a third variable.
color.plot.default(x,y,z,labels=NULL,data=parent.frame(), xlab,ylab,zlab, xlim=NULL,ylim=NULL, axes=T,key=T,add=F,nlevels=4, color.palette=default.colors,col, pch.palette=c(1,4,2,22,16,17,15),pch, jitter=F,digits=2,mar,bg,...)
x,y |
numeric vectors of the same length. |
z |
a numeric vector or factor, same length as
x and y . |
labels |
a character vector of labels, same length as z .
If NULL, cases are plotted as points (default). |
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 z is numeric, it is
color-coded using this many levels. (If z is a factor,
color-coding follows the factor levels.) |
color.palette |
a vector of colors, arbitrary length, or a
function with integer
argument which generates a vector of colors (e.g.
YlGnBu.colors ).
Used if col
is not specified. If shorter than the number of
levels, colors will be recycled and the plotting symbol will change. |
col |
a vector of colors, as in a call to plot . Used
to explicitly set the color of each point. |
pch.palette |
a vector of plotting symbols, arbitrary length. If
labels=NULL , the plot symbol will
rotate through these when there aren't enough colors. |
pch |
a vector of plotting symbols, as in a call to plot .
Used to explicitly set the symbol of each point. |
digits |
the number of digits to use in the color key when z
is numeric. |
bg |
the background color |
mar |
figure margins (see par ). If not specified,
appropriate margins will be chosen automatically, which will not
necessarily match the current value of par("mar") . |
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
,clode{color.plot.glm},color.plot.knn
,color.plot.tree
,YlGnBu.colors
# See the examples for color.plot.data.frame