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 | scatterplot(x, ...)
## S3 method for class 'formula'
scatterplot(formula, data, subset, xlab, ylab, id=FALSE,
legend=TRUE, ...)
## Default S3 method:
scatterplot(x, y, smooth=TRUE, id=FALSE, legend=TRUE,
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,
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), ellipse=FALSE,
col=if (n.groups == 1) palette()[3:1] else rep(palette(), length=n.groups),
pch=1:n.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. |
smooth |
specifies the smoother to be used along with its arguments; if |
id |
controls point identification; if |
legend |
controls placement and properties of a legend if the plot is drawn by groups; if |
spread |
if TRUE, estimate the (square root) of the variance function. For the |
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 |
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 |
ellipse |
controls plotting data-concentration ellipses. 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 |
reset.par |
if |
grid |
If TRUE, the default, a light-gray background grid is put on the graph |
... |
other arguments passed down and to |
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 | scatterplot(prestige ~ income, data=Prestige, ellipse=TRUE)
scatterplot(prestige ~ income, data=Prestige, smooth=list(smoother=quantregLine))
scatterplot(prestige ~ income | type, data=Prestige,
smooth=list(smoother=loessLine, span=1))
scatterplot(prestige ~ income | type, data=Prestige, legend=list(coords="topleft"))
scatterplot(vocabulary ~ education, jitter=list(x=1, y=1),
data=Vocab, smooth=FALSE, lwd=3)
scatterplot(infant.mortality ~ gdp, log="xy", data=UN, id=list(n=5))
scatterplot(income ~ type, data=Prestige)
if(interactive()){ # remember to exit from point-identification mode
scatterplot(infant.mortality ~ gdp, id=list(method="identify"), data=UN)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.