[R] assign same legend colors than in the grouped data plot

agent dunham crosspide at hotmail.com
Wed Feb 15 15:35:50 CET 2012


Dear community, 

I've plotted  data and coloured depending on the factor variable v3. 
In the legend, I'd like to assign properly  the same colors than in the
factor (the factor has 5 levels).

I've been trying this but it doesn't work.

plot(var1, var2, xlab = "var1", ylab = "var2", col =var3 , bty='L')
legend(locator(1),c("level 1 var3",  "level 2 var3","level 3 var3",  "level
4 var3","level 5 var3"), col=var3,pch=16)


Thanks in advance, crosspide at hotmail.com

--
View this message in context: http://r.789695.n4.nabble.com/assign-same-legend-colors-than-in-the-grouped-data-plot-tp4390641p4390641.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list