[R] Legend with different sized symbols

J. Pedro Granadeiro jpgranadeiro at fc.ul.pt
Thu Aug 5 10:49:52 CEST 2004

Dear list,

I wonder if it is possible to produce a legend with symbols of different sizes 
using a single legend command. I managed to do so more or less like in this 
crude example, but there is probably a smarter and more practical way:

plot(rnorm(100), rnorm(100), cex=rep(1:5,each=20))
x<-legend(-2,2.8, legend=1:5, pch="  ",y.intersp=2, bty="n")
points(x$text$x-.2,x$text$y, cex=1:5)

I tried with playing with cex inside the legend command, but this gave me 
funny results, since it manipulates the overall size of symbols plus text. I 
was looking for something like "pt.cex", but this probably it does not 


Jose Pedro Granadeiro

More information about the R-help mailing list