Description Usage Arguments Value Author(s) See Also Examples
Makes enhanced scatterplots, with boxplots in the margins, a nonparametric regression smooth,
smoothed conditional spread, outlier identification, and a regression line;
sp
is an abbreviation for scatterplot
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | scatterplot(x, ...)
## S3 method for class 'formula'
scatterplot(formula, data, subset, xlab, ylab, legend.title, legend.coords,
labels, ...)
## Default S3 method:
scatterplot(x, y,
smoother=loessLine, smoother.args=list(), smooth, span,
spread=!by.groups, reg.line=lm,
boxplots=if (by.groups) "" else "xy",
xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), las=par("las"),
lwd=1, lty=1,
labels, id.method = "mahal",
id.n = if(id.method[1]=="identify") length(x) else 0,
id.cex = 1, id.col = palette()[1], id.location="lr",
log="", jitter=list(), xlim=NULL, ylim=NULL,
cex=par("cex"), cex.axis=par("cex.axis"), cex.lab=par("cex.lab"),
cex.main=par("cex.main"), cex.sub=par("cex.sub"),
groups, by.groups=!missing(groups),
legend.title=deparse(substitute(groups)), legend.coords, legend.columns,
ellipse=FALSE, levels=c(.5, .95), robust=TRUE,
col=if (n.groups == 1) palette()[3:1] else rep(palette(), length=n.groups),
pch=1:n.groups,
legend.plot=!missing(groups), reset.par=TRUE, grid=TRUE, ...)
sp(x, ...)
|
x |
vector of horizontal coordinates (or first argument of generic function). |
y |
vector of vertical coordinates. |
formula |
a “model” formula, of the form |
data |
data frame within which to evaluate the formula. |
subset |
expression defining a subset of observations. |
smoother |
a function to draw a nonparametric-regression smooth; the default is |
smoother.args |
a list of named values to be passed to the smoother function; the specified elements of the
list depend upon the smoother (see |
smooth, span |
these arguments are included for backwards compatility:
if |
spread |
if TRUE, estimate the (square root) of the variance function. For |
reg.line |
function to draw a regression line on the plot
or |
boxplots |
if |
xlab |
label for horizontal axis. |
ylab |
label for vertical axis. |
las |
if |
lwd |
width of linear-regression lines (default |
lty |
type of linear-regression lines (default |
id.method,id.n,id.cex,id.col,id.location |
Arguments for the labelling of
points. The default is |
labels |
a vector of point labels; if absent, the function tries to determine reasonable labels, and, failing that, will use observation numbers. |
log |
same as the |
jitter |
a list with elements |
xlim |
the x limits (min, max) of the plot; if |
ylim |
the y limits (min, max) of the plot; if |
groups |
a factor or other variable dividing the data into groups; groups are plotted with different colors and plotting characters. |
by.groups |
if |
legend.title |
title for legend box; defaults to the name of the groups variable. |
legend.coords |
coordinates for placing legend; can be a list with components x and y to
specify the coordinates of the upper-left-hand corner of the legend; or a quoted keyword, such as |
legend.columns |
number of columns for the legend; if absent will be supplied automatically to prefer horizontal legends when plotted above the graph. |
ellipse |
if |
levels |
level or levels at which concentration ellipses are plotted;
the default is |
robust |
if |
col |
colors for lines and points; the default is taken from the color palette,
with |
pch |
plotting characters for points; default is the plotting characters in
order (see |
cex, cex.axis, cex.lab, cex.main, cex.sub |
set sizes of various graphical elements;
(see |
legend.plot |
if |
reset.par |
if |
... |
other arguments passed down and to |
grid |
If TRUE, the default, a light-gray background grid is put on the graph |
If points are identified, their labels are returned; otherwise NULL
is returned invisibly.
John Fox jfox@mcmaster.ca
boxplot
,
jitter
, legend
,
scatterplotMatrix
, dataEllipse
, Boxplot
,
cov.trob
,
showLabels
, ScatterplotSmoothers
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | scatterplot(prestige ~ income, data=Prestige, ellipse=TRUE)
if (interactive()){
scatterplot(prestige ~ income, data=Prestige, smoother=quantregLine)
}
scatterplot(prestige ~ income|type, data=Prestige, smoother=loessLine,
smoother.args=list(span=1))
scatterplot(prestige ~ income|type, data=Prestige, legend.coords="topleft")
scatterplot(vocabulary ~ education, jitter=list(x=1, y=1),
data=Vocab, id.n=0, smoother=FALSE)
scatterplot(infant.mortality ~ gdp, log="xy", data=UN, id.n=5)
scatterplot(income ~ type, data=Prestige)
## Not run:
scatterplot(infant.mortality ~ gdp, id.method="identify", data=UN)
scatterplot(infant.mortality ~ gdp, id.method="identify", smoother=loessLine, data=UN)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.