[R] How do I get a character and a symbol in a legend

steve fisk at bowdoin.edu
Wed Jan 23 18:27:24 CET 2008


In the following snippet

plot(1:10,1:10,type="n")
points(1:5,1:5,pch="+")
points(6:10,6:10,pch=20)
legend(5,5, c("A","B"), pch=c("+",20))

I want to get a legend with a "+" and a solid circle (pch=20).
However, what I get in the legend is "+" and "2". How can I get a "+" 
and a solid circle?

thanks,  Steve

 > sessionInfo()
R version 2.6.1 (2007-11-26)
i686-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

loaded via a namespace (and not attached):
[1] rcompgen_0.1-17



More information about the R-help mailing list