Description Usage Arguments Examples
myplot()
use match.call
to record R call.using \\ is more convenient, see examples.
1 |
... |
all R call to recording |
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ## Not run:
set.seed(1)
x=rnorm(100)
y=x*5+rnorm(100)
png(file="test1.png",units = "cm",width = 15, height = 15, units = "cm",res=300)
plot(x,y,pch=20)
lm=lm(y~x)
abline(lm,col="red")
points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20)
dev.off()
pdf(file="test1.pdf")
plot(x,y,pch=20)
lm=lm(y~x)
abline(lm,col="red")
points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20)
dev.off()
# myplot 1
p=myplot(set.seed(1),
x=rnorm(100),
y=x*5+rnorm(100),
plot(x,y,pch=20),
lm=lm(y~x),
abline(lm,col="red"),
points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20))
plotsave(p)
plotsave(p,file="test2.png",width = 15, height = 15, units = "cm")
plotsave(p,file="test2.pdf",width = 150, height = 150, units = "mm")
# myplot 2
#using {} more convenient
rm(list=ls())
set.seed(1)
x=rnorm(100)
y=x*5+rnorm(100)
p=myplot({
plot(x,y,pch=20)
lm=lm(y~x)
abline(lm,col="red")
points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20)
})
plotsave(p)
plotsave(p,file="test3.png",width = 15, height = 15, units = "cm")
plotsave(p,file="test3.pdf",width = 150, height = 150, units = "mm")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.