[R] Plot legend

Jim Lemon jim at bitwrit.com.au
Sat Apr 11 12:10:48 CEST 2009


Sherri Heck wrote:
> Dear All-
>
> I am trying to create a legend where the first 9 terms are represented as pch=16 in one column (which I am able to do); but, I would like the last two terms in that column to be 'lines" (which are black and red - just as it looks like in the plot).  I have read through many help pages and searched the help listserv, but haven't figured this one out yet.  Does anyone have any suggestions or if you could point me to a help page that i may have missed, I would greatly appreciate it. a bit of my code is below:
>   
Hi Sherri,
A really quick hack is to use the hyphen for the lines:

legend("topright",c('Level 1','Level 2','Level 3', 'Level 4','Level 5',
 'Level 6','Level 7','Level 8','Level 9','RAC UNFILT','RAC FILT 1 sig'),
 pch=c(16,16,16,16,16,16,16,16,16,45,45),
 col=c('skyblue4','green','orange','light green','dark green','yellow',
 'dark blue','purple','dark red','black','red'),ncol=1)

Jim




More information about the R-help mailing list