Menu

[r27]: / trunk / R / generic.scatter.plot.R  Maximize  Restore  History

Download this file

28 lines (27 with data), 733 Bytes

 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
generic.scatter.plot <- function(x,y,ann=NULL,pch=1,
fit.line=F,axis.round=2,
lty.x.y=0,one.to.one=F,...) {
par(mfrow=c(1,1))
if(one.to.one) {
xi <- yi <- c(min(x,y),max(x,y))
} else {
xi <- x
yi <- y
}
plot(xi,yi,type='n',bty='n',xaxt='n',yaxt='n',...)
axis(1,round(quantile(x),axis.round),lty=0,las=3)
axis(2,round(quantile(y),axis.round),lty=0,las=1)
axis(1,x,rep("+",length(x)),lty=0,line=-1)
axis(2,y,rep("+",length(y)),lty=0,line=-1)
if(fit.line) {
fit <- lm(y ~ x)
abline(fit)
}
abline(0,1,lty=lty.x.y)
if(!is.null(ann)) {
text(x,y,ann)
} else {
points(x,y,pch=pch)
}
mtext(paste('n =',length(x)))
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.