Description Usage Arguments Value Author(s) Examples
Produces a scatter plot of two variables with (possibly stratified) superimposed lowess smooths and least squares fitted lines.
1 2 3 4 5 | scatter(y, x, strata=rep(1,length(y)), subset= rep(TRUE,length(y)),
reference=sort(unique(strata)), plotPoints=TRUE, plotLowess=TRUE, plotLSfit=FALSE,
legend=0.05, colors=c("black", "blue", "orange", "pink", "green", "red",
"cornflowerblue", "darkolivegreen", "magenta"), xJitter=TRUE, yJitter=FALSE,
newplot=TRUE, lty=1:6, lwd=1, log="",pch=1:25, ..., version=FALSE)
|
y |
a numeric vector containing the values to be plotted on the y-axis. |
x |
a numeric vector containing the values to be plotted on the x-axis. |
strata |
a vector, matrix, or list of stratification variables. Descriptive statistics will be computed within strata defined by each unique combination of the stratification variables, as well as in the combined sample. If |
subset |
a vector indicating a subset to be used for all descriptive statistics. If |
reference |
a list of the strata in the order they are to be plotted. |
plotPoints |
an indicator that points are to be plotted. A different color and point type combination will be used for each stratum. Default value is |
plotLowess |
an indicator that lowess smoths are to be plotted. A different color and line type combination will be used for each stratum. Default value is |
plotLSfit |
an indicator that least squares fitted lines are to be plotted. A different color and line type combination will be used for each stratum. Default value is |
legend |
where to place the legend on the plot |
colors |
a vector of colors used in plotting strata. |
xJitter |
the proportion of the minimal difference between adjacent x-values divided by 8 by which plotted points are to be jittered in the x-dimension. A value of 0 implies no jittering. |
yJitter |
the proportion of the minimal difference between adjacent y-values divided by 8 by which plotted points are to be jittered in the y-dimension. A value of 0 implies no jittering. |
newplot |
logical value indicating that the graph should be plotted on a new set of axes. Default value is |
lty, lwd, log,pch |
plotting parameters. |
... |
optional arguments for plotting parameters (e.g. |
version |
if |
This function produces a plot. No value is returned.
Scott S. Emerson, M.D., Ph.D., Andrew J. Spieker, Brian D. Williamson, Travis Y. Hee Wai, and Solomon Lim
1 2 3 4 5 6 7 8 9 10 | #- Read in and attach the data -#
mri <- read.table("http://www.emersonstatistics.com/datasets/mri.txt", header=TRUE)
attach(mri)
#- Create a scatterplot with lowess curves and least squares fitted regression lines -#
scatter(atrophy, age, ylab="Atrophy", xlab="Age")
#- Create a scatterplot stratified by age on the log scale with lowess curves and -#
#- least squares fitted regression lines -#
scatter(atrophy, age, strata=male,ylab="Atrophy", xlab="Age",log="y")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.