[Rd] legend lwd - feature request (PR#7023)

Lfo at psykiatri.aaa.dk Lfo at psykiatri.aaa.dk
Fri Jun 25 11:03:42 CEST 2004


(R1.9.1 Windows)

In legend( ) lwd have no effect on points - contrary to the behaviour
in e.g. plot( ) and points( ). It would be nice to have an option pt.lwd
affecting the line width of legend points (like pt.cex changes the
magnification).


An example (note the difference in line width between points in the
plot and the legend):
x <- 1:10 ; y <- rnorm(10,10,5) ; y2 <- rnorm(10,8,4)
plot(x,y,bty="l",lwd=3,type="o",col=2,ylim=c(min(y,y2),max(y,y2)),cex=1.5)
points(x,y2,lwd=3,lty=8,col=4,type="o",pch=2,cex=1.5)
legend(10,max(y,y2),legend=c("Method 1","Method
2"),col=c(2,4),lty=c(1,8),pch=c(1,2),
    xjust=1,yjust=1,pt.cex=1.5,lwd=3)

Workaround (thanks to Peter Dalgaard):
x <- 1:10 ; y <- rnorm(10,10,5) ; y2 <- rnorm(10,8,4)
plot(x,y,bty="l",lwd=3,type="o",col=2,ylim=c(min(y,y2),max(y,y2)),cex=1.5)
points(x,y2,lwd=3,lty=8,col=4,type="o",pch=2,cex=1.5)
legend(10,max(y,y2),legend=c("Method 1","Method
2"),col=c(0,0),lty=c(1,8),pch=c(1,2),
    xjust=1,yjust=1,pt.cex=1.5,lwd=0,text.col=0)
pp <- par(lwd=3)
legend(10,max(y,y2),legend=c("Method 1","Method 2"),
    col=c(2,4),lty=c(1,8),pch=c(1,2), 
    xjust=1,yjust=1,pt.cex=1.5,lwd=3,bty="n")
par(pp)


-- 
Leslie Foldager
Cand.scient., Statistiker
Afdeling for Psykiatrisk Demografi
Tlf.: (+45) 7789 2865
Email: lfo at psykiatri.aaa.dk
Web: www.psychdem.dk



More information about the R-devel mailing list