[未知用户] library(Layer)
Layer()
x=seq(-pi,pi,len=41)
plot(x,sin(x),type="l",ylim=c(-2,2),col=2,lty=2)
points(x,cos(x),pch=3,col=4)
add.layer("title")
title("legend(***,lty=c(-2,2),pch=c(-2,3))",cex.main=1,1)
add.layer("legend")
legend(-1,2,c("sin","cos"),col=(3,4),lty=c(2,-1),
pch=c(-3,3),bg="gray99")
上面这段,执行完添加legend图层,原图没有任何变化
将title换成legend,重新执行,结果提示命令错误,如下
> library(Layer)
> Layer()
> x=seq(-pi,pi,len=41)
> plot(x,sin(x),type="l",ylim=c(-2,2),col=2,lty=2)
> points(x,cos(x),pch=3,col=4)
> add.layer("legend")
> legend("legend(***,lty=c(-2,2),pch=c(-2,3))",
+ cex.main=1,1)
错误于legend("legend(***,lty=c(-2,2),pch=c(-2,3))",
cex.main = 1, 1) :
参数((cex.main = 1)) 没有用
> legend("legend(***,lty=c(-2,2),pch=c(-2,3))",1)
错误于is.language(x) : 缺少'x'