[R] lw in legend also changes thickness of characters in the legend??
Deepayan Sarkar
deepayan.sarkar at gmail.com
Thu May 15 00:59:29 CEST 2008
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
More information about the R-help
mailing list