[R] Legend with different sized symbols

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Aug 5 16:10:31 CEST 2004


J. Pedro Granadeiro wrote:

> 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:
> 
> set.seed(0)
> 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"

... and exactly that one exists in recent versions of R (e.g. R-1.9.1)!

Uwe Ligges


> , but this probably it does not exist...
> 
> Thanks
> 
> Jose Pedro Granadeiro
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list