plot.xy.ab.p | R Documentation |
This function performs a simple scatter plot but also superimposses a linear regression trend (abline) and optionally also the p-value of this line
## S3 method for class 'xy.ab.p'
plot(x, x.var, y.var,
fit.line=TRUE, p.value=TRUE, slope=TRUE, p.col=c('red','gray','green'),
plot.labels=TRUE, verbose=TRUE, xlab=x.var, ylab=y.var, ...)
x |
a data frame |
x.var |
the name of the x variable in df |
y.var |
the name of the y variable in df |
fit.line |
should a fit (ab) line be drawn? |
p.value |
should the p-value be printed on the plot? |
slope |
should the slope be printed on the plot? |
p.col |
should the plot be labeled? |
plot.labels |
should all of thie model fit information be printed out? |
verbose |
should all other information be printed out too? |
xlab |
label for x-axis |
ylab |
label for y-axis |
... |
other parameters passed to 'plot' |
An x/y scatterplot with regression line
par(mfrow=c(6,5), mar=c(2,2,0,0), mgp=c(-1,.5,0))
eg.df <- expand.grid(names(swiss), names(swiss))
for(i in 1:nrow(eg.df)){
print(i)
xv <- as.character(eg.df[i,1]); print(xv)
yv <- as.character(eg.df[i,2]); print(yv)
if(yv != xv)
plot.xy.ab.p(x=swiss, x.var=xv, y.var=yv, p.value=FALSE, slope=FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.