Levi Waldron
2008-May-14 21:16 UTC
[R] lw in legend also changes thickness of characters in the legend??
Here's a simple example: x <- 1:5 plot(x,x^2) lines(x,x^2) points(x,x,cex=2) lines(x,x,lw=3) legend("topleft",legend=c("y=x^2","y=x"),pch=1,pt.cex=1:2,lw=c(1,3)) The thickness of the circles in the legend changes with lw. If you change the lw argument in legend to lw=c(1,1) then the thickness of the circles goes back to normal. How can I make the above legend so that both the lines and the plotting characters match what is in the graph? [[alternative HTML version deleted]]
Deepayan Sarkar
2008-May-14 22:59 UTC
[R] lw in legend also changes thickness of characters in the legend??
On 5/14/08, Levi Waldron <leviwaldron at gmail.com> wrote:> Here's a simple example: > > x <- 1:5 > plot(x,x^2) > lines(x,x^2) > points(x,x,cex=2) > lines(x,x,lw=3) > legend("topleft",legend=c("y=x^2","y=x"),pch=1,pt.cex=1:2,lw=c(1,3)) > > The thickness of the circles in the legend changes with lw. If you change > the lw argument in legend to lw=c(1,1) then the thickness of the circles > goes back to normal. How can I make the above legend so that both the lines > and the plotting characters match what is in the graph??legend is quite explicit about this: pt.lwd: line width for the points, defaults to the one for lines, or if that is not set, to 'par("lwd")'. -Deepayan